diff options
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 20 | ||||
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 5 | ||||
| -rw-r--r-- | lisp/files.el | 10 | ||||
| -rw-r--r-- | lisp/finder.el | 1 | ||||
| -rw-r--r-- | lisp/net/ange-ftp.el | 4 | ||||
| -rw-r--r-- | lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | lispref/files.texi | 9 | ||||
| -rw-r--r-- | lispref/hooks.texi | 3 |
9 files changed, 56 insertions, 6 deletions
| @@ -1737,6 +1737,11 @@ configuration files. | |||
| 1737 | 1737 | ||
| 1738 | * Lisp Changes in Emacs 21.4 | 1738 | * Lisp Changes in Emacs 21.4 |
| 1739 | 1739 | ||
| 1740 | ** The new hook `before-save-hook' is invoked by `basic-save-buffer' | ||
| 1741 | before saving buffers. This allows packages to perform various final | ||
| 1742 | tasks, for example; it can be used by the copyright package to make | ||
| 1743 | sure saved files have the current year in any copyright headers. | ||
| 1744 | |||
| 1740 | ** The function `insert-for-yank' now supports strings where the | 1745 | ** The function `insert-for-yank' now supports strings where the |
| 1741 | `yank-handler' property does not span the first character of the | 1746 | `yank-handler' property does not span the first character of the |
| 1742 | string. The old behavior is available if you call | 1747 | string. The old behavior is available if you call |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 14963f0ef8c..67e62e7025a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2004-01-05 Karl Berry <karl@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/copyright.el (copyright-regexp): might as well allow | ||
| 4 | / and *, too. | ||
| 5 | |||
| 6 | 2003-12-31 Simon Josefsson <jas@extundo.com> | ||
| 7 | |||
| 8 | * files.el (before-save-hook): Add. | ||
| 9 | (basic-save-buffer): Use before-save-hook. | ||
| 10 | |||
| 11 | * emacs-lisp/copyright.el: Fix comment to recommend | ||
| 12 | before-save-hook instead of write-file-functions. | ||
| 13 | |||
| 14 | 2004-01-05 Richard M. Stallman <rms@gnu.org> | ||
| 15 | |||
| 16 | * finder.el (finder-commentary): Call delete-other-windows. | ||
| 17 | |||
| 18 | * net/ange-ftp.el (ange-ftp-file-attributes): | ||
| 19 | Pass 2 args to ange-ftp-real-file-attributes only if ID-FORMAT non-nil. | ||
| 20 | |||
| 1 | 2004-01-04 Karl Berry <karl@gnu.org> | 21 | 2004-01-04 Karl Berry <karl@gnu.org> |
| 2 | 22 | ||
| 3 | * emacs-lisp/copyright.el (copyright-regexp): allow the common | 23 | * emacs-lisp/copyright.el (copyright-regexp): allow the common |
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 4532f7e5b77..6a95c60f859 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -27,7 +27,8 @@ | |||
| 27 | 27 | ||
| 28 | ;; Allows updating the copyright year and above mentioned GPL version manually | 28 | ;; Allows updating the copyright year and above mentioned GPL version manually |
| 29 | ;; or when saving a file. | 29 | ;; or when saving a file. |
| 30 | ;; Do (add-hook 'write-file-functions 'copyright-update). | 30 | ;; Do (add-hook 'before-save-hook 'copyright-update), or use |
| 31 | ;; M-x customize-variable RET before-save-hook RET. | ||
| 31 | 32 | ||
| 32 | ;;; Code: | 33 | ;;; Code: |
| 33 | 34 | ||
| @@ -47,7 +48,7 @@ A value of nil means to search whole buffer." | |||
| 47 | (defcustom copyright-regexp | 48 | (defcustom copyright-regexp |
| 48 | "\\([]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\ | 49 | "\\([]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\ |
| 49 | \\|[Cc]opyright\\s *:?\\s *[]\\)\ | 50 | \\|[Cc]opyright\\s *:?\\s *[]\\)\ |
| 50 | \\s *\\([1-9]\\([-0-9, ';%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" | 51 | \\s *\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" |
| 51 | "*What your copyright notice looks like. | 52 | "*What your copyright notice looks like. |
| 52 | The second \\( \\) construct must match the years." | 53 | The second \\( \\) construct must match the years." |
| 53 | :group 'copyright | 54 | :group 'copyright |
diff --git a/lisp/files.el b/lisp/files.el index ec58906e485..e74ef0bcbc1 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2990,6 +2990,12 @@ the last real save, but optional arg FORCE non-nil means delete anyway." | |||
| 2990 | (defvar auto-save-hook nil | 2990 | (defvar auto-save-hook nil |
| 2991 | "Normal hook run just before auto-saving.") | 2991 | "Normal hook run just before auto-saving.") |
| 2992 | 2992 | ||
| 2993 | (defcustom before-save-hook nil | ||
| 2994 | "Normal hook that is run before a buffer is saved to its file." | ||
| 2995 | :options '(copyright-update) | ||
| 2996 | :type 'hook | ||
| 2997 | :group 'files) | ||
| 2998 | |||
| 2993 | (defcustom after-save-hook nil | 2999 | (defcustom after-save-hook nil |
| 2994 | "Normal hook that is run after a buffer is saved to its file." | 3000 | "Normal hook that is run after a buffer is saved to its file." |
| 2995 | :options '(executable-make-buffer-file-executable-if-script-p) | 3001 | :options '(executable-make-buffer-file-executable-if-script-p) |
| @@ -3012,7 +3018,8 @@ in such cases.") | |||
| 3012 | The hooks `write-contents-functions' and `write-file-functions' get a chance | 3018 | The hooks `write-contents-functions' and `write-file-functions' get a chance |
| 3013 | to do the job of saving; if they do not, then the buffer is saved in | 3019 | to do the job of saving; if they do not, then the buffer is saved in |
| 3014 | the visited file file in the usual way. | 3020 | the visited file file in the usual way. |
| 3015 | After saving the buffer, this function runs `after-save-hook'." | 3021 | Before and after saving the buffer, this function runs |
| 3022 | `before-save-hook' and `after-save-hook', respectively." | ||
| 3016 | (interactive) | 3023 | (interactive) |
| 3017 | (save-current-buffer | 3024 | (save-current-buffer |
| 3018 | ;; In an indirect buffer, save its base buffer instead. | 3025 | ;; In an indirect buffer, save its base buffer instead. |
| @@ -3068,6 +3075,7 @@ After saving the buffer, this function runs `after-save-hook'." | |||
| 3068 | (insert ?\n)))) | 3075 | (insert ?\n)))) |
| 3069 | ;; Support VC version backups. | 3076 | ;; Support VC version backups. |
| 3070 | (vc-before-save) | 3077 | (vc-before-save) |
| 3078 | (run-hooks 'before-save-hook) | ||
| 3071 | (or (run-hook-with-args-until-success 'write-contents-functions) | 3079 | (or (run-hook-with-args-until-success 'write-contents-functions) |
| 3072 | (run-hook-with-args-until-success 'local-write-file-hooks) | 3080 | (run-hook-with-args-until-success 'local-write-file-hooks) |
| 3073 | (run-hook-with-args-until-success 'write-file-functions) | 3081 | (run-hook-with-args-until-success 'write-file-functions) |
diff --git a/lisp/finder.el b/lisp/finder.el index 2958f36c3d9..0bd001752fe 100644 --- a/lisp/finder.el +++ b/lisp/finder.el | |||
| @@ -282,6 +282,7 @@ FILE should be in a form suitable for passing to `locate-library'." | |||
| 282 | (error "Can't find any Commentary section")) | 282 | (error "Can't find any Commentary section")) |
| 283 | ;; This used to use *Finder* but that would clobber the | 283 | ;; This used to use *Finder* but that would clobber the |
| 284 | ;; directory of categories. | 284 | ;; directory of categories. |
| 285 | (delete-other-windows) | ||
| 285 | (pop-to-buffer "*Finder-package*") | 286 | (pop-to-buffer "*Finder-package*") |
| 286 | (setq buffer-read-only nil) | 287 | (setq buffer-read-only nil) |
| 287 | (erase-buffer) | 288 | (erase-buffer) |
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 0277bd0aabc..8e1068a5bed 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el | |||
| @@ -3468,7 +3468,9 @@ system TYPE.") | |||
| 3468 | inode ;10 "inode number". | 3468 | inode ;10 "inode number". |
| 3469 | -1 ;11 device number [v19 only] | 3469 | -1 ;11 device number [v19 only] |
| 3470 | )))) | 3470 | )))) |
| 3471 | (ange-ftp-real-file-attributes file id-format)))) | 3471 | (if id-format |
| 3472 | (ange-ftp-real-file-attributes file id-format) | ||
| 3473 | (ange-ftp-real-file-attributes file))))) | ||
| 3472 | 3474 | ||
| 3473 | (defun ange-ftp-file-newer-than-file-p (f1 f2) | 3475 | (defun ange-ftp-file-newer-than-file-p (f1 f2) |
| 3474 | (let ((f1-parsed (ange-ftp-ftp-name f1)) | 3476 | (let ((f1-parsed (ange-ftp-ftp-name f1)) |
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 1ef5bca1d46..d61b756401a 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2004-01-01 Simon Josefsson <jas@extundo.com> | ||
| 2 | |||
| 3 | * hooks.texi (Standard Hooks): Add before-save-hook. | ||
| 4 | * files.texi (Saving Buffers): Likewise. | ||
| 5 | |||
| 1 | 2004-01-03 Richard M. Stallman <rms@gnu.org> | 6 | 2004-01-03 Richard M. Stallman <rms@gnu.org> |
| 2 | 7 | ||
| 3 | * frames.texi (Frames and Windows): Delete frame-root-window. | 8 | * frames.texi (Frames and Windows): Delete frame-root-window. |
diff --git a/lispref/files.texi b/lispref/files.texi index 575a90ccf92..b461273b5fe 100644 --- a/lispref/files.texi +++ b/lispref/files.texi | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004 |
| 4 | @c Free Software Foundation, Inc. | 4 | @c Free Software Foundation, Inc. |
| 5 | @c See the file elisp.texi for copying conditions. | 5 | @c See the file elisp.texi for copying conditions. |
| 6 | @setfilename ../info/files | 6 | @setfilename ../info/files |
| @@ -410,6 +410,13 @@ This variable automatically becomes buffer-local whenever it is set; | |||
| 410 | switching to a new major mode always resets this variable. | 410 | switching to a new major mode always resets this variable. |
| 411 | @end defvar | 411 | @end defvar |
| 412 | 412 | ||
| 413 | @defvar before-save-hook | ||
| 414 | This normal hook runs before a buffer has been saved in its visited | ||
| 415 | file. One use of this hook is for the Copyright package; it uses this | ||
| 416 | hook to make sure the file has the current year in the copyright | ||
| 417 | header. | ||
| 418 | @end defvar | ||
| 419 | |||
| 413 | @c Emacs 19 feature | 420 | @c Emacs 19 feature |
| 414 | @defvar after-save-hook | 421 | @defvar after-save-hook |
| 415 | This normal hook runs after a buffer has been saved in its visited file. | 422 | This normal hook runs after a buffer has been saved in its visited file. |
diff --git a/lispref/hooks.texi b/lispref/hooks.texi index fde028a3d14..bc90c8773c2 100644 --- a/lispref/hooks.texi +++ b/lispref/hooks.texi | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1998 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1990, 1991, 1992, 1993, 1998, 2004 Free Software Foundation, Inc. |
| 4 | @c See the file elisp.texi for copying conditions. | 4 | @c See the file elisp.texi for copying conditions. |
| 5 | @setfilename ../info/hooks | 5 | @setfilename ../info/hooks |
| 6 | @node Standard Hooks, Index, Standard Keymaps, Top | 6 | @node Standard Hooks, Index, Standard Keymaps, Top |
| @@ -47,6 +47,7 @@ however, we have renamed all of those.) | |||
| 47 | @item before-init-hook | 47 | @item before-init-hook |
| 48 | @item before-make-frame-hook | 48 | @item before-make-frame-hook |
| 49 | @item before-revert-hook | 49 | @item before-revert-hook |
| 50 | @item before-save-hook | ||
| 50 | @item blink-paren-function | 51 | @item blink-paren-function |
| 51 | @item buffer-access-fontify-functions | 52 | @item buffer-access-fontify-functions |
| 52 | @item c-mode-hook | 53 | @item c-mode-hook |