comparison lisp/files.el @ 83284:360860a0006f

Merged from miles@gnu.org--gnu-2005 (patch 45-55, 214-231) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-214 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-215 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-216 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-217 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-218 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-219 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-220 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-221 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-222 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-223 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-224 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-225 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-226 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-227 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-228 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-229 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-230 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-231 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-45 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-46 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-47 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-48 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-49 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-50 Update from CVS: texi Makefile.in CVS keyw cruft * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-51 Update from CVS: ChangeLog tweaks * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-52 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-53 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-54 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-55 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-324
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 04 Apr 2005 16:43:15 +0000
parents 2006100ee57e c7462c0b2dc0
children 9deb6323655c
comparison
equal deleted inserted replaced
83283:45e5f0224d81 83284:360860a0006f
289 (const :tag "Never" nil) 289 (const :tag "Never" nil)
290 (other :tag "Ask" ask)) 290 (other :tag "Ask" ask))
291 :group 'editing-basics) 291 :group 'editing-basics)
292 292
293 (defcustom mode-require-final-newline t 293 (defcustom mode-require-final-newline t
294 "*Whether to add a newline at the end of the file, in certain major modes. 294 "*Whether to add a newline at end of file, in certain major modes.
295 Those modes set `require-final-newline' to this value when you enable them. 295 Those modes set `require-final-newline' to this value when you enable them.
296 They do so because they are used for files that are supposed 296 They do so because they are used for files that are supposed
297 to end in newlines, and the question is how to arrange that. 297 to end in newlines, and the question is how to arrange that.
298 298
299 A value of t means do this only when the file is about to be saved. 299 A value of t means do this only when the file is about to be saved.
300 A value of `visit' means do this right after the file is visited. 300 A value of `visit' means do this right after the file is visited.
301 A value of `visit-save' means do it at both of those times. 301 A value of `visit-save' means do it at both of those times.
302 Any other non-nil value means ask user whether to add a newline, when saving." 302 Any other non-nil value means ask user whether to add a newline, when saving.
303 nil means don't add newlines.
304
305 You will have to be careful if you set this to nil: you will have
306 to remember to manually add a final newline whenever you finish a
307 file that really needs one."
303 :type '(choice (const :tag "When visiting" visit) 308 :type '(choice (const :tag "When visiting" visit)
304 (const :tag "When saving" t) 309 (const :tag "When saving" t)
305 (const :tag "When visiting or saving" visit-save) 310 (const :tag "When visiting or saving" visit-save)
311 (const :tag "Never" nil)
306 (other :tag "Ask" ask)) 312 (other :tag "Ask" ask))
307 :group 'editing-basics 313 :group 'editing-basics
308 :version "22.1") 314 :version "22.1")
309 315
310 (defcustom auto-save-default t 316 (defcustom auto-save-default t
926 (raise-frame (window-frame (selected-window))))) 932 (raise-frame (window-frame (selected-window)))))
927 933
928 (defvar find-file-default nil 934 (defvar find-file-default nil
929 "Used within `find-file-read-args'.") 935 "Used within `find-file-read-args'.")
930 936
937 (defmacro minibuffer-with-setup-hook (fun &rest body)
938 "Add FUN to `minibuffer-setup-hook' while executing BODY.
939 BODY should use the minibuffer at most once.
940 Recursive uses of the minibuffer will not be affected."
941 (declare (indent 1) (debug t))
942 (let ((hook (make-symbol "setup-hook")))
943 `(let ((,hook
944 (lambda ()
945 ;; Clear out this hook so it does not interfere
946 ;; with any recursive minibuffer usage.
947 (remove-hook 'minibuffer-setup-hook ,hook)
948 (,fun))))
949 (unwind-protect
950 (progn
951 (add-hook 'minibuffer-setup-hook ,hook)
952 ,@body)
953 (remove-hook 'minibuffer-setup-hook ,hook)))))
954
931 (defun find-file-read-args (prompt mustmatch) 955 (defun find-file-read-args (prompt mustmatch)
932 (list (let ((find-file-default 956 (list (let ((find-file-default
933 (and buffer-file-name 957 (and buffer-file-name
934 (abbreviate-file-name buffer-file-name))) 958 (abbreviate-file-name buffer-file-name))))
935 (munge-default-fun 959 (minibuffer-with-setup-hook
936 (lambda () 960 (lambda () (setq minibuffer-default find-file-default))
937 (setq minibuffer-default find-file-default) 961 (read-file-name prompt nil default-directory mustmatch)))
938 ;; Clear out this hook so it does not interfere
939 ;; with any recursive minibuffer usage.
940 (pop minibuffer-setup-hook)))
941 (minibuffer-setup-hook
942 minibuffer-setup-hook))
943 (add-hook 'minibuffer-setup-hook munge-default-fun)
944 (read-file-name prompt nil default-directory mustmatch))
945 t)) 962 t))
946 963
947 (defun find-file (filename &optional wildcards) 964 (defun find-file (filename &optional wildcards)
948 "Edit file FILENAME. 965 "Edit file FILENAME.
949 Switch to a buffer visiting file FILENAME, 966 Switch to a buffer visiting file FILENAME,