all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Backup Blacklist
@ 2007-01-01 12:45 Matthew Flaschen
  2007-01-02  1:51 ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-01 12:45 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 124 bytes --]

Does anyone know a good way to maintain a blacklist of files that will
never be backed up by emacs?

Matthew Flaschen


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-01 12:45 Backup Blacklist Matthew Flaschen
@ 2007-01-02  1:51 ` Juanma Barranquero
  2007-01-02  7:02   ` Matthew Flaschen
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-02  1:51 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/1/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> Does anyone know a good way to maintain a blacklist of files that will
> never be backed up by emacs?

If I understand correctly what you're asking for, I use something
similar to the following on my .emacs:

(require 'cl)
(require 'regexp-opt)

;; Set this to t or nil if you don't want the default.
;; It is used in my-backup-enable-predicate
(defvar my-backup-case-fold case-fold-search)

(defun my-exclude-from-backup (&rest files)
  "Exclude from backup all filenames in FILES.
They must be absolute paths.
Other files are passed to `normal-backup-enable-predicate',
so is still possible for them to be excluded anyway."
  (let ((excluded (get 'my-exclude-from-backup :files)))
    (mapc #'(lambda (file)
              (unless (file-name-absolute-p file)
                (error "%s is not an absolute filename" file))
              (pushnew file excluded :test #'equal))
          files)
    (put 'my-exclude-from-backup :files excluded)
    (put 'my-exclude-from-backup
         :regexp (concat "^" (regexp-opt excluded) "$"))))

(defun my-backup-enable-predicate (file)
  "Alternate `backup-enable-predicate' function that excludes from
backups those files registered with `my-exclude-from-backup'."
  (let ((regexp (get 'my-exclude-from-backup :regexp)))
    (if (and regexp
             (let ((case-fold-search my-backup-case-fold))
               (string-match regexp file)))
        nil
      (normal-backup-enable-predicate file))))

(setq backup-enable-predicate 'my-backup-enable-predicate)

;; and now, you can exclude files from backup with:
(my-exclude-from-backup "/this/file" "/that/other/file")


                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-02  1:51 ` Juanma Barranquero
@ 2007-01-02  7:02   ` Matthew Flaschen
  2007-01-02 13:01     ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-02  7:02 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 577 bytes --]

Juanma Barranquero wrote:
> On 1/1/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:
> 
>> Does anyone know a good way to maintain a blacklist of files that will
>> never be backed up by emacs?
> 
> If I understand correctly what you're asking for, I use something
> similar to the following on my .emacs:
> 
> ;; and now, you can exclude files from backup with:
> (my-exclude-from-backup "/this/file" "/that/other/file")

Thanks!  I mostly understand the script, but how could I make
my-exclude-from-backup interactive?

Matthew Flaschen








[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-02  7:02   ` Matthew Flaschen
@ 2007-01-02 13:01     ` Juanma Barranquero
  2007-01-02 21:06       ` Matthew Flaschen
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-02 13:01 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/2/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> Thanks!  I mostly understand the script, but how could I make
> my-exclude-from-backup interactive?

Use this additional function:

 (defun my-exclude-file-from-backup (&optional file)
   (interactive (list (read-file-name "File to exclude: " nil nil t
buffer-file-name)))
   (my-exclude-from-backup (expand-file-name file)))

It should default to the buffer's visited file.

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-02 13:01     ` Juanma Barranquero
@ 2007-01-02 21:06       ` Matthew Flaschen
  2007-01-02 22:22         ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-02 21:06 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1098 bytes --]

Juanma Barranquero wrote:

> (defun my-exclude-file-from-backup (&optional file)
>   (interactive (list (read-file-name "File to exclude: " nil nil t
> buffer-file-name)))
>   (my-exclude-from-backup (expand-file-name file)))
> 

Thanks.  I did take the time to look around before, and found
(interactive), but couldn't get it to work.  I'm struggling to learn
lisp.  It's so different from the whole C/C++/Java tradition.  However,
I changed it to:

(defun my-exclude-file-from-backup (&optional file)
  (interactive (list (read-file-name "File to exclude: " "" nil t
buffer-file-name)))
  (my-exclude-from-backup (expand-file-name file)))

Your code was making it show
like:

/data/Documents//data/Documents/Reason.txt

I.E. directory *then* full file name.  Changing the default directory to
the empty string fixed that.

However, this also excludes other files containing the full path.  Thus,
 for exampled, if I excluded:

/data/Documents/cool.c

It will also exclude

/data/Documents/cool.cpp

I don't know enough regex to fix that.

Matthew Flaschen


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-02 21:06       ` Matthew Flaschen
@ 2007-01-02 22:22         ` Juanma Barranquero
  2007-01-03  1:13           ` Matthew Flaschen
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-02 22:22 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/2/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> Changing the default directory to the empty string fixed that.

Hmm, I don't think that's correct. Try with this (it has a couple
small bug fixes):


(require 'cl)
(require 'regexp-opt)

;; Set this to t or nil if you don't want the default.
;; It is used in my-backup-enable-predicate
(defvar my-backup-case-fold case-fold-search)

(defun my-exclude-from-backup (&rest files)
 "Exclude from backup all filenames in FILES.
They must be absolute paths.
Other files are passed to `normal-backup-enable-predicate',
so is still possible for them to be excluded anyway."
 (let ((excluded (get 'my-exclude-from-backup :files)))
   (mapc #'(lambda (file)
             (unless (file-name-absolute-p file)
               (error "%s is not an absolute filename" file))
             (pushnew (expand-file-name file) excluded :test #'equal))
         files)
   (put 'my-exclude-from-backup :files excluded)
   (put 'my-exclude-from-backup
        :regexp (concat "^" (regexp-opt excluded) "$"))))

(defun my-backup-enable-predicate (file)
 "Alternate `backup-enable-predicate' function that excludes from
backups those files registered with `my-exclude-from-backup'."
 (let ((regexp (get 'my-exclude-from-backup :regexp)))
   (if (and regexp
            (let ((case-fold-search my-backup-case-fold))
              (string-match regexp (expand-file-name file))))
       nil
     (normal-backup-enable-predicate file))))

(defun my-exclude-file-from-backup (&optional file)
 (interactive (list (read-file-name "File to exclude: " nil nil t
                                    (file-name-nondirectory buffer-file-name))))
 (my-exclude-from-backup file))

(setq backup-enable-predicate 'my-backup-enable-predicate)


> However, this also excludes other files containing the full path.  Thus,
>  for exampled, if I excluded:
>
> /data/Documents/cool.c
>
> It will also exclude
>
> /data/Documents/cool.cpp

Try now.

  (my-backup-enable-predicate "/data/Documents/cool.c")

should return nil, and

  (my-backup-enable-predicate "/data/Documents/cool.cpp")

should return t.

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-02 22:22         ` Juanma Barranquero
@ 2007-01-03  1:13           ` Matthew Flaschen
  2007-01-03  1:25             ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-03  1:13 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 678 bytes --]

Juanma Barranquero wrote:
> On 1/2/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:
> 
>> Changing the default directory to the empty string fixed that.
> 
> Hmm, I don't think that's correct. 


Well, your way (file-name-nondirectory) is better.  I didn't know about
that function.  However, none of the scripts work overall, your old way,
 with my modification, or with your new code. I was testing it wrong.
Apparently, emacs stopping backing up a file if you delete the backup
while it's running.  But this only lasts until you exit emacs.

The prompt comes up, but the script just doesn't work; the files still
get backed up.

Matthew Flaschen


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-03  1:13           ` Matthew Flaschen
@ 2007-01-03  1:25             ` Juanma Barranquero
  2007-01-03  5:48               ` Matthew Flaschen
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-03  1:25 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/3/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> However, none of the scripts work overall, your old way,
>  with my modification, or with your new code.

I don't know what are you doing, but "my way" definitely works. It's
what I've been using (with some small changes) for years. And I've
just tested it right now, and performs as expected.

> The prompt comes up, but the script just doesn't work; the files still
> get backed up.

Have you evaled the code I sent? It is my-backup-enable-predicate
assigned to the variable `backup-enable-predicate'?

Also note that any excluding you do with `my-exclude-file-from-backup'
is not persistent: it won't be active the next time you invoke Emacs.
If you want a persistent excluding, you must use
`my-exclude-from-backup' from your .emacs startup file, as shown in
the first message I sent in this thread.

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-03  1:25             ` Juanma Barranquero
@ 2007-01-03  5:48               ` Matthew Flaschen
  2007-01-03 11:56                 ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-03  5:48 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 612 bytes --]

Juanma Barranquero wrote:
> Also note that any excluding you do with `my-exclude-file-from-backup'
> is not persistent: it won't be active the next time you invoke Emacs.
> If you want a persistent excluding, you must use
> `my-exclude-from-backup' from your .emacs startup file, as shown in
> the first message I sent in this thread.

My mistake.  I kind of thought it wouldn't be persistent (and it's still
not persistent if you put it in .emacs, just repeated), but I didn't
know enough lisp to be sure.  Thanks for clarifying.  I'll see if I can
rig up a persistent version.

Matthew Flaschen


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-03  5:48               ` Matthew Flaschen
@ 2007-01-03 11:56                 ` Juanma Barranquero
  2007-01-03 12:30                   ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-03 11:56 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/3/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> (and it's still
> not persistent if you put it in .emacs, just repeated)

That's a kind of Emacs persistency :)

> I'll see if I can
> rig up a persistent version.

It shouldn't be difficult: you use `kill-emacs-hook' to save the data
to a file in your home dir, and load it again in your .emacs.

For example, you can add the following to your .emacs:

(add-hook 'kill-emacs-hook
          #'(lambda ()
              (with-temp-file "~/.emacs.d/persistent-excludes"
                (mapc #'(lambda (file)
                          (insert (format "(my-exclude-from-backup
\"%s\")\n" file)))
                      (get 'my-exclude-from-backup :files)))))

(load-file "~/.emacs.d/persistent-excludes")

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-03 11:56                 ` Juanma Barranquero
@ 2007-01-03 12:30                   ` Juanma Barranquero
  2007-01-03 23:41                     ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-03 12:30 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/3/07, Juanma Barranquero <lekktu@gmail.com> wrote:

> (load-file "~/.emacs.d/persistent-excludes")

For the sake of completeness, this is more user-friendly:

 (condition-case nil
     (load-file "~/.emacs.d/persistent-excludes")
   (error (message "Cannot load persistent excludes")))


                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-03 12:30                   ` Juanma Barranquero
@ 2007-01-03 23:41                     ` Juanma Barranquero
  2007-01-04  7:18                       ` Matthew Flaschen
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-03 23:41 UTC (permalink / raw)
  Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

On 1/3/07, Juanma Barranquero <lekktu@gmail.com> wrote:

I've put it all in a package (lightly tested, BTW). Hope it helps, and
hope the docstrings are documentation enough :)

                    /L/e/k/t/u

[-- Attachment #2: backup-exclude.el --]
[-- Type: application/octet-stream, Size: 5859 bytes --]

;;; backup-exclude.el --- exclude individual files from backup

;; Copyright (C) 2007 Juanma Barranquero
;; Author: Juanma Barranquero <lekktu@gmail.com>
;; Keywords: backup

;; This file is not yet part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

(eval-when-compile (require 'cl))
(require 'regexp-opt)

(defgroup backup-exclude nil
  "Exclude files from backup."
  :group 'emacs)

;; Internal
(defvar bex-mode nil)
(defvar bex-previous-backup-predicate nil)

(defcustom bex-save-file "~/.emacs.d/backup-exclusions"
  "File to save the backup exclusion list.
Set to nil to deactivate saving of the exclusion list."
  :type '(choice file (const :tag "None" nil))
  :set #'(lambda (sym val)
           (set-default sym val)
           (when bex-mode
             (if val
                 (add-hook 'emacs-kill-hook 'bex-save-exclusions)
               (remove-hook 'emacs-kill-hook 'bex-save-exclusions))))
  :group 'backup-exclude)

(defcustom bex-case-fold-search case-fold-search
  "Whether to ignore case when matching files in the exclusion list."
  :type 'boolean
  :group 'backup-exclude)

(defun bex-exclude-files (&rest files)
  "Exclude from backup all filenames in FILES.
They must be absolute paths.
Other files are passed to the function previously pointed by
`backup-enable-predicate', so it is still possible for them
to be excluded anyway."
  (let ((excluded (get 'backup-exclude :files)))
    (when files
      (mapc #'(lambda (file)
                (unless (file-name-absolute-p file)
                  (error "%s is not an absolute filename" file))
                (pushnew (expand-file-name file) excluded :test #'equal))
            files)
      (put 'backup-exclude :files excluded))
    ;; Recompute the regexp cache
    (put 'backup-exclude :regexp (and excluded
                                      (concat "^" (regexp-opt excluded) "$")))))

(defun bex-exclude-file-from-backup (&optional file)
  "Exclude FILE from backup.
Defaults to the current buffer's visited file, if any."
  (interactive (list (read-file-name "File to exclude from backup: " nil nil t
                                     (file-name-nondirectory buffer-file-name))))
  (bex-exclude-files file))

(defun bex-remove-exclusion (&rest files)
  "Remove FILES from the backup exclusion list.
They are still passed to the function previously pointed by
`backup-enable-predicate', so it is still possible for them
to be excluded anyway."
  (let ((excluded (get 'backup-exclude :files)))
    (mapc #'(lambda (file)
              (setq excluded (delete (expand-file-name file) excluded)))
          files)
    (put 'backup-exclude :files excluded)
    (bex-exclude-files)))

(defun bex-enable-predicate (file)
  "Alternate `backup-enable-predicate' function that excludes from
backups those files registered with `bex-exclude-files' or
`bex-exclude-file-from-backup'."
  (let ((regexp (get 'backup-exclude :regexp)))
    (if (and regexp
             (let ((case-fold-search bex-case-fold-search))
               (string-match regexp (expand-file-name file))))
        nil
      (funcall bex-previous-backup-predicate file))))

(defun bex-save-exclusions ()
  "Save the backup exclusion list in file `bex-save-file' (which see).
This function is intended to be called from `emacs-kill-hook'."
  (let ((dir (file-name-directory bex-save-file)))
    (unless (file-directory-p dir) (make-directory dir t)))
  (with-temp-file bex-save-file
    (insert ";; backup-exclude save file\n;; version: 1.0\n(bex-exclude-files ")
    (mapc #'(lambda (file)
              (insert (format "  \"%s\"\n" file)))
          (get 'backup-exclude :files))
    (insert ")\n")))

(defun bex-restore-exclusions ()
  "Restore the backup exclusion list from file `bex-save-file' (which see).
This function is intended to be called from your `.emacs'."
  (when (file-exists-p bex-save-file)
    (load-file bex-save-file)))

(defun bex-mode (&optional arg)
  "Toggle BEX (backup exclusion) mode.
When active, files excluded through `bex-exclude-files' and
`bex-exclude-file-from-backup' are not backed up.
With ARG, set BEX mode on iff ARG is positive, off otherwise."
  (interactive "P")
  (setq arg (if (null arg)
                (not bex-mode)
              (> (prefix-numeric-value arg) 0)))
  (cond ((eq arg bex-mode)
         (message "No change"))
        ((setq bex-mode arg)
         (setq bex-previous-backup-predicate backup-enable-predicate)
         (setq backup-enable-predicate 'bex-enable-predicate)
         (when bex-save-file
           (add-hook 'emacs-kill-hook 'bex-save-exclusions))
         (message "Backup exclusion active"))
        ((eq backup-enable-predicate 'bex-enable-predicate)
         (setq backup-enable-predicate bex-previous-backup-predicate)
         (setq bex-previous-backup-predicate nil)
         (remove-hook 'emacs-kill-hook 'bex-save-exclusions)
         (message "Backup exclusion inactive"))
        (t (error "`backup-enable-predicate' has been hijacked."))))

(provide 'backup-exclude)

;; end of backup-exclude.el

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-03 23:41                     ` Juanma Barranquero
@ 2007-01-04  7:18                       ` Matthew Flaschen
  2007-01-05 12:39                         ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-04  7:18 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 358 bytes --]

Juanma Barranquero wrote:
> On 1/3/07, Juanma Barranquero <lekktu@gmail.com> wrote:
> 
> I've put it all in a package (lightly tested, BTW). Hope it helps, and
> hope the docstrings are documentation enough :)

Thanks for all your patience and help.  I really appreciate it (even
though I haven't finished testing the package).

Matthew Flaschen


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-04  7:18                       ` Matthew Flaschen
@ 2007-01-05 12:39                         ` Juanma Barranquero
  2007-01-25  1:15                           ` Matthew Flaschen
  0 siblings, 1 reply; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-05 12:39 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 1/4/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> Thanks for all your patience and help.

It's been fun ;)

> (even
> though I haven't finished testing the package).

When you test it, use this version of `bex-enable-predicate':

(defun bex-enable-predicate (file)
  "Alternate `backup-enable-predicate' function that excludes from
backups those files registered with `bex-exclude-files' or
`bex-exclude-file-from-backup'."
  (if bex-previous-backup-predicate
      (let ((regexp (get 'backup-exclude :regexp)))
        (if (and regexp
                 (let ((case-fold-search bex-case-fold-search))
                   (string-match regexp (expand-file-name file))))
            nil
          (funcall bex-previous-backup-predicate file)))
    nil))

It's a small change to support the case that `backup-enable-predicate'
is nil (which is uncommon, but possible). Note that in this case, no
file is ever backed up (because backup-exclude can only exclude files,
and there's no function ever returning t for any of them).

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-05 12:39                         ` Juanma Barranquero
@ 2007-01-25  1:15                           ` Matthew Flaschen
  2007-01-25  1:22                             ` Juanma Barranquero
  0 siblings, 1 reply; 16+ messages in thread
From: Matthew Flaschen @ 2007-01-25  1:15 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]

Juanma Barranquero wrote:
> When you test it, use this version of `bex-enable-predicate':
> 
> (defun bex-enable-predicate (file)
>  "Alternate `backup-enable-predicate' function that excludes from
> backups those files registered with `bex-exclude-files' or
> `bex-exclude-file-from-backup'."
>  (if bex-previous-backup-predicate
>      (let ((regexp (get 'backup-exclude :regexp)))
>        (if (and regexp
>                 (let ((case-fold-search bex-case-fold-search))
>                   (string-match regexp (expand-file-name file))))
>            nil
>          (funcall bex-previous-backup-predicate file)))
>    nil))
> 
> It's a small change to support the case that `backup-enable-predicate'
> is nil (which is uncommon, but possible). Note that in this case, no
> file is ever backed up (because backup-exclude can only exclude files,
> and there's no function ever returning t for any of them).
> 

Thanks, I updated it. :)  It's still been working fine (though I haven't
used it all that often).

Matthew Flaschen


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Backup Blacklist
  2007-01-25  1:15                           ` Matthew Flaschen
@ 2007-01-25  1:22                             ` Juanma Barranquero
  0 siblings, 0 replies; 16+ messages in thread
From: Juanma Barranquero @ 2007-01-25  1:22 UTC (permalink / raw)
  To: Matthew Flaschen; +Cc: help-gnu-emacs

On 1/25/07, Matthew Flaschen <matthew.flaschen@gatech.edu> wrote:

> It's still been working fine (though I haven't
> used it all that often).

Glad to hear (I'm talking about the first part, of course ;-)

                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-01-25  1:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-01 12:45 Backup Blacklist Matthew Flaschen
2007-01-02  1:51 ` Juanma Barranquero
2007-01-02  7:02   ` Matthew Flaschen
2007-01-02 13:01     ` Juanma Barranquero
2007-01-02 21:06       ` Matthew Flaschen
2007-01-02 22:22         ` Juanma Barranquero
2007-01-03  1:13           ` Matthew Flaschen
2007-01-03  1:25             ` Juanma Barranquero
2007-01-03  5:48               ` Matthew Flaschen
2007-01-03 11:56                 ` Juanma Barranquero
2007-01-03 12:30                   ` Juanma Barranquero
2007-01-03 23:41                     ` Juanma Barranquero
2007-01-04  7:18                       ` Matthew Flaschen
2007-01-05 12:39                         ` Juanma Barranquero
2007-01-25  1:15                           ` Matthew Flaschen
2007-01-25  1:22                             ` Juanma Barranquero

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.