Ignore automatically generated Emacs files

How to diffignore temporary files, for example foo.c~? Is there a configuration file that will ignore temporary defaults?

More generally: what is the best way to create a “clean” patch from tarball? I do this quite rarely (by sending a bug fix to the OSS project by email) that I always fight with it ...

EDIT: OK short answer

diff -ruN -x *~ ...

Is there a better answer? For example, can this go in the configuration file?

+3
source share
4 answers

, , Emacs . Emacs XEmacs.

GNU Emacs

    (defvar user-temporary-file-directory
      (concat temporary-file-directory user-login-name "/"))
    (make-directory user-temporary-file-directory t)
    (setq backup-by-copying t)
    (setq backup-directory-alist
      `(("." . ,user-temporary-file-directory)
        (,tramp-file-name-regexp nil)))
    (setq auto-save-list-file-prefix
      (concat user-temporary-file-directory ".auto-saves-"))
    (setq auto-save-file-name-transforms
      `((".*" ,user-temporary-file-directory t)))

XEmacs

    (require 'auto-save) 
    (require 'backup-dir) 

    (defvar user-temporary-file-directory
      (concat (temp-directory) "/" (user-login-name)))
    (make-directory user-temporary-file-directory t)
    (setq backup-by-copying t)
    (setq auto-save-directory user-temporary-file-directory)
    (setq auto-save-list-file-prefix 
         (concat user-temporary-file-directory ".auto-saves-"))
    (setq bkup-backup-directory-info
      `((t ,user-temporary-file-directory full-path)))

find

    find . -name "*~" -delete

, , .

, . , "" .

+4

, :

core.*
*~
*.o
*.a
*.so
<more file patterns you want to skip>

diff -X, :

diff -X ignore-file <other diff options you use/need> path1 path2

.diffignore, "" Linux (, ), . , , .

+2

/ script, :

#!/bin/bash
olddir="/tmp/old"
newdir="/tmp/new"

pushd $newdir
for files in $(find . -name \*.c)
do
  diff $olddir/$file $newdir/$file
done
popd

script. . , .

- emacs , , !

0

" ":

diff -ruN -x *~ ...

* globbed diff.

:

diff -r -x '*~' dir1 dir2

-u -N, .

0
source

Source: https://habr.com/ru/post/1696573/


All Articles