changeset 83006:892c6294eb08

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-19 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-20 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-21 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-46
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 06 Jan 2004 17:09:40 +0000
parents 0b195559ccf5 (current diff) edbcb3c5d4e3 (diff)
children c0cb35d94ea7
files lisp/ChangeLog
diffstat 9 files changed, 56 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Mon Jan 05 05:58:50 2004 +0000
+++ b/etc/NEWS	Tue Jan 06 17:09:40 2004 +0000
@@ -1737,6 +1737,11 @@
 
 * Lisp Changes in Emacs 21.4
 
+** The new hook `before-save-hook' is invoked by `basic-save-buffer'
+before saving buffers.  This allows packages to perform various final
+tasks, for example; it can be used by the copyright package to make
+sure saved files have the current year in any copyright headers.
+
 ** The function `insert-for-yank' now supports strings where the
 `yank-handler' property does not span the first character of the
 string.  The old behavior is available if you call
--- a/lisp/ChangeLog	Mon Jan 05 05:58:50 2004 +0000
+++ b/lisp/ChangeLog	Tue Jan 06 17:09:40 2004 +0000
@@ -1,3 +1,23 @@
+2004-01-05  Karl Berry  <karl@gnu.org>
+
+	* emacs-lisp/copyright.el (copyright-regexp): might as well allow
+	/ and *, too.
+
+2003-12-31  Simon Josefsson  <jas@extundo.com>
+
+	* files.el (before-save-hook): Add.
+	(basic-save-buffer): Use before-save-hook.
+
+	* emacs-lisp/copyright.el: Fix comment to recommend
+	before-save-hook instead of write-file-functions.
+
+2004-01-05  Richard M. Stallman  <rms@gnu.org>
+
+	* finder.el (finder-commentary): Call delete-other-windows.
+
+	* net/ange-ftp.el (ange-ftp-file-attributes):
+	Pass 2 args to ange-ftp-real-file-attributes only if ID-FORMAT non-nil.
+
 2004-01-04  Karl Berry  <karl@gnu.org>
 
 	* emacs-lisp/copyright.el (copyright-regexp): allow the common
--- a/lisp/emacs-lisp/copyright.el	Mon Jan 05 05:58:50 2004 +0000
+++ b/lisp/emacs-lisp/copyright.el	Tue Jan 06 17:09:40 2004 +0000
@@ -27,7 +27,8 @@
 
 ;; Allows updating the copyright year and above mentioned GPL version manually
 ;; or when saving a file.
-;; Do (add-hook 'write-file-functions 'copyright-update).
+;; Do (add-hook 'before-save-hook 'copyright-update), or use
+;; M-x customize-variable RET before-save-hook RET.
 
 ;;; Code:
 
@@ -47,7 +48,7 @@
 (defcustom copyright-regexp
  "\\([]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\
 \\|[Cc]opyright\\s *:?\\s *[]\\)\
-\\s *\\([1-9]\\([-0-9, ';%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
+\\s *\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
   "*What your copyright notice looks like.
 The second \\( \\) construct must match the years."
   :group 'copyright
--- a/lisp/files.el	Mon Jan 05 05:58:50 2004 +0000
+++ b/lisp/files.el	Tue Jan 06 17:09:40 2004 +0000
@@ -2990,6 +2990,12 @@
 (defvar auto-save-hook nil
   "Normal hook run just before auto-saving.")
 
+(defcustom before-save-hook nil
+  "Normal hook that is run before a buffer is saved to its file."
+  :options '(copyright-update)
+  :type 'hook
+  :group 'files)
+
 (defcustom after-save-hook nil
   "Normal hook that is run after a buffer is saved to its file."
   :options '(executable-make-buffer-file-executable-if-script-p)
@@ -3012,7 +3018,8 @@
 The hooks `write-contents-functions' and `write-file-functions' get a chance
 to do the job of saving; if they do not, then the buffer is saved in
 the visited file file in the usual way.
-After saving the buffer, this function runs `after-save-hook'."
+Before and after saving the buffer, this function runs
+`before-save-hook' and `after-save-hook', respectively."
   (interactive)
   (save-current-buffer
     ;; In an indirect buffer, save its base buffer instead.
@@ -3068,6 +3075,7 @@
 		     (insert ?\n))))
 	    ;; Support VC version backups.
 	    (vc-before-save)
+	    (run-hooks 'before-save-hook)
 	    (or (run-hook-with-args-until-success 'write-contents-functions)
 		(run-hook-with-args-until-success 'local-write-file-hooks)
 		(run-hook-with-args-until-success 'write-file-functions)
--- a/lisp/finder.el	Mon Jan 05 05:58:50 2004 +0000
+++ b/lisp/finder.el	Tue Jan 06 17:09:40 2004 +0000
@@ -282,6 +282,7 @@
 	(error "Can't find any Commentary section"))
     ;; This used to use *Finder* but that would clobber the
     ;; directory of categories.
+    (delete-other-windows)
     (pop-to-buffer "*Finder-package*")
     (setq buffer-read-only nil)
     (erase-buffer)
--- a/lisp/net/ange-ftp.el	Mon Jan 05 05:58:50 2004 +0000
+++ b/lisp/net/ange-ftp.el	Tue Jan 06 17:09:40 2004 +0000
@@ -3468,7 +3468,9 @@
 		      inode		;10 "inode number".
 		      -1		;11 device number [v19 only]
 		      ))))
-      (ange-ftp-real-file-attributes file id-format))))
+      (if id-format
+	  (ange-ftp-real-file-attributes file id-format)
+	(ange-ftp-real-file-attributes file)))))
 
 (defun ange-ftp-file-newer-than-file-p (f1 f2)
   (let ((f1-parsed (ange-ftp-ftp-name f1))
--- a/lispref/ChangeLog	Mon Jan 05 05:58:50 2004 +0000
+++ b/lispref/ChangeLog	Tue Jan 06 17:09:40 2004 +0000
@@ -1,3 +1,8 @@
+2004-01-01  Simon Josefsson  <jas@extundo.com>
+
+	* hooks.texi (Standard Hooks): Add before-save-hook.
+	* files.texi (Saving Buffers): Likewise.
+
 2004-01-03  Richard M. Stallman  <rms@gnu.org>
 
 	* frames.texi (Frames and Windows): Delete frame-root-window.
--- a/lispref/files.texi	Mon Jan 05 05:58:50 2004 +0000
+++ b/lispref/files.texi	Tue Jan 06 17:09:40 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/files
@@ -410,6 +410,13 @@
 switching to a new major mode always resets this variable.
 @end defvar
 
+@defvar before-save-hook
+This normal hook runs before a buffer has been saved in its visited
+file.  One use of this hook is for the Copyright package; it uses this
+hook to make sure the file has the current year in the copyright
+header.
+@end defvar
+
 @c Emacs 19 feature
 @defvar after-save-hook
 This normal hook runs after a buffer has been saved in its visited file.
--- a/lispref/hooks.texi	Mon Jan 05 05:58:50 2004 +0000
+++ b/lispref/hooks.texi	Tue Jan 06 17:09:40 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1998, 2004 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/hooks
 @node Standard Hooks, Index, Standard Keymaps, Top
@@ -47,6 +47,7 @@
 @item before-init-hook
 @item before-make-frame-hook
 @item before-revert-hook
+@item before-save-hook
 @item blink-paren-function
 @item buffer-access-fontify-functions
 @item c-mode-hook