aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey2004-07-18 21:49:24 +0000
committerKaroly Lorentey2004-07-18 21:49:24 +0000
commit31d7e9bc5a474c2da8c40f4812ea3e09cd5fb82c (patch)
tree729a3c238e43ed5625290e994d9ef0d09c18241a /lisp
parent4cb2afc64f004ba91ff0bd37cf8ca6669b228988 (diff)
parentcdfa3eccb179fe579a5e38949d0a2ad3d2757524 (diff)
downloademacs-31d7e9bc5a474c2da8c40f4812ea3e09cd5fb82c.tar.gz
emacs-31d7e9bc5a474c2da8c40f4812ea3e09cd5fb82c.zip
Merged in changes from CVS trunk.
Patches applied: * lorentey@elte.hu--2004/emacs--hacks--0--patch-2 Prevent special events from appending dashes to the echo string. * lorentey@elte.hu--2004/emacs--hacks--0--patch-4 Added ChangeLog entry. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-454 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-455 Bash the dashes * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-456 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-457 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-458 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-459 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-460 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-219
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog131
-rw-r--r--lisp/autorevert.el150
-rw-r--r--lisp/bindings.el15
-rw-r--r--lisp/buff-menu.el14
-rw-r--r--lisp/calendar/cal-dst.el4
-rw-r--r--lisp/dired.el3
-rw-r--r--lisp/emacs-lisp/testcover.el223
-rw-r--r--lisp/emulation/cua-base.el21
-rw-r--r--lisp/font-lock.el12
-rw-r--r--lisp/mail/footnote.el7
-rw-r--r--lisp/mh-e/mh-loaddefs.el2
-rw-r--r--lisp/net/tramp-smb.el2
-rw-r--r--lisp/net/tramp-vc.el18
-rw-r--r--lisp/net/tramp.el219
-rw-r--r--lisp/progmodes/grep.el2
-rw-r--r--lisp/progmodes/which-func.el28
-rw-r--r--lisp/replace.el3
-rw-r--r--lisp/simple.el19
18 files changed, 647 insertions, 226 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b860134af46..876646163e3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,126 @@
12004-07-17 Kai Grossjohann <kai.grossjohann@gmx.net>
2
3 * net/tramp.el (tramp-handle-verify-visited-file-modtime): New
4 docstring. From Luc Teirlinck.
5
62004-07-17 Luc Teirlinck <teirllm@auburn.edu>
7
8 * autorevert.el: Describe `Auto Revert Tail Mode' in `Commentary'
9 section.
10 (auto-revert-handler): Do not check `auto-revert-tail-mode' for
11 non-file buffers. We know it is nil.
12
132004-07-17 Kai Grossjohann <kai.grossjohann@gmx.net>
14
15 Sync with Tramp 2.0.43.
16
17 * net/tramp.el (tramp-handle-verify-visited-file-modtime): Remove
18 outdated comment.
19 (tramp-locked, tramp-locker): New variables for implementing a
20 global lock.
21 (tramp-sh-file-name-handler): Use them to implement the global
22 lock.
23
242004-07-13 Michael Albinus <michael.albinus@gmx.de>
25
26 * net/tramp.el (all): Code cleanup. Change all `tramp-handle-xxx'
27 calls to respective `xxx` calls.
28 (tramp-process-alive-regexp): Precise doc string.
29 (tramp-multi-action-process-alive): New defun.
30 (tramp-multi-actions): Use it.
31 (tramp-handle-find-backup-file-name): `copy-tree' is available
32 since Emacs 21.4 only (XEmacs has it). Implementation rewritten
33 in order to avoid this function.
34 (tramp-handle-write-region): Set current buffer. If connection
35 wasn't open, `file-modes' has changed it accidently. Reported by
36 David Kastrup <dak@gnu.org>.
37 (tramp-enter-password, tramp-read-passwd): New arguments USER and
38 HOST.
39 (tramp-action-password, tramp-multi-action-password): Apply it.
40 (tramp-open-connection-rsh): If a port is given, the Tramp buffer
41 name must still contain the port number. Otherwise, we have two
42 Tramp buffers, with all the confusion. Reported by Myron Selby
43 <myron@xytech.com> and Rolf Dubitzky
44 <Dubitzky@physi.uni-heidelberg.de>.
45
46 * net/tramp-smb.el (tramp-smb-open-connection): Apply USER and
47 HOST to `tramp-enter-passwd'.
48
49 * net/tramp-vc.el (all): Code cleanup. Change all
50 `tramp-handle-xxx' calls to respective `xxx` calls.
51
522004-07-17 Jonathan Yavner <jyavner@member.fsf.org>
53
54 * emacs-lisp/testcover.el: New category "potentially-1valued" for
55 functions that are not erroneous if either 1-valued or
56 multi-valued. Detect functions in this class.
57 (testcover-1value-functions, testcover-compose-functions,
58 testcover-progn-functions) Added some additional functions to lists.
59 (testcover-mark): Bugfix when marking up the definition for an
60 empty function.
61
622004-07-17 Richard M. Stallman <rms@gnu.org>
63
64 * replace.el (occur-read-primary-args): Pass default to read-from-minibuffer.
65
66 * mail/footnote.el (footnote-section-tag): Use defcustom.
67
68 * font-lock.el (font-lock-add-keywords, font-lock-remove-keywords):
69 Compile font-lock-keywords, not KEYWORDS.
70 (lisp-font-lock-keywords-2): Add multiple-value-prog1, go.
71 Add warn, check-type. Handle cerror like error.
72
732004-07-14 Daniel Pfeiffer <occitan@esperanto.org>
74
75 * progmodes/which-func.el (which-func-keymap): New var.
76 (which-func-face): New face.
77 (which-func-format): Use them.
78
792004-07-16 Stephan Stahl <stahl@eos.franken.de> (tiny change)
80
81 * buff-menu.el (list-buffers-noselect): Append the buffer's
82 process status to its mode name.
83
842004-07-16 Kim F. Storm <storm@cua.dk>
85
86 * simple.el (inhibit-mark-movement): New defvar.
87 (beginning-of-buffer, end-of-buffer): Do not push mark if
88 inhibit-mark-movement is non-nil or C-u prefix is given.
89
90 * emulation/cua-base.el (cua--preserve-mark-commands): New defvar.
91 Init to beginning-of-buffer and end-of-buffer.
92 (cua--undo-push-mark): New defvar.
93 (cua--pre-command-handler): Set inhibit-mark-movement if mark is
94 already active and command is in cua--preserve-mark-commands.
95 Also fix check for shift modifier on non-window systems.
96 (cua--post-command-handler): Clear inhibit-mark-movement if set.
97
982004-07-14 Luc Teirlinck <teirllm@auburn.edu>
99
100 * calendar/cal-dst.el (calendar-time-from-absolute): Return a list
101 of two integers, instead of a cons.
102
103 * net/tramp.el (tramp-handle-verify-visited-file-modtime):
104 `visited-file-modtime' now returns a list of two integers, instead
105 of a cons.
106
107 * dired.el (dired-directory-changed-p): Ditto.
108
109 * progmodes/grep.el (grep): Doc fix.
110
1112004-07-14 Daniel Pfeiffer <occitan@esperanto.org>
112
113 * autorevert.el (auto-revert-tail-mode)
114 (auto-revert-tail-mode-text, auto-revert-tail-pos): New vars.
115 (auto-revert-mode): Turn off auto-revert-tail-mode, so we're not
116 in both at the same time.
117 (auto-revert-tail-mode): New command.
118 (turn-on-auto-revert-tail-mode, auto-revert-tail-handler): New funs.
119 (auto-revert-handler): Revert only either tail or whole file.
120
121 * bindings.el (mode-line-mode-menu): Fix alphabetical ordering and
122 add auto-revert-tail-mode.
123
12004-07-12 Vinicius Jose Latorre <viniciusjl@ig.com.br> 1242004-07-12 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2 125
3 * printing.el: Doc fix. Change name of some funs. 126 * printing.el: Doc fix. Change name of some funs.
@@ -1475,6 +1598,14 @@
1475 (timer-event-handler): Set triggered-p element non-nil while running 1598 (timer-event-handler): Set triggered-p element non-nil while running
1476 the timer function. 1599 the timer function.
1477 1600
16012004-05-14 Stefan Monnier <monnier@iro.umontreal.ca>
1602
1603 * descr-text.el (describe-char-unicode-data)
1604 (describe-char-unicodedata-file): Re-enable the unicode code now that
1605 the licensing issues have been cleared in the unicode-4 license.
1606 (describe-text-properties-1): Remove unused `overlay' var.
1607 (describe-char): Remove unused var `buffer'.
1608
14782004-05-14 David Ponce <david@dponce.com> 16092004-05-14 David Ponce <david@dponce.com>
1479 1610
1480 * tree-widget.el: New file. 1611 * tree-widget.el: New file.
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 7b786882cf6..ef438eb4b97 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -34,7 +34,8 @@
34;; 34;;
35;; This package contains two minor modes: Global Auto-Revert Mode and 35;; This package contains two minor modes: Global Auto-Revert Mode and
36;; Auto-Revert Mode. Both modes automatically revert buffers 36;; Auto-Revert Mode. Both modes automatically revert buffers
37;; whenever the corresponding files have been changed on disk. 37;; whenever the corresponding files have been changed on disk and the
38;; buffer contains no unsaved changes.
38;; 39;;
39;; Auto-Revert Mode can be activated for individual buffers. Global 40;; Auto-Revert Mode can be activated for individual buffers. Global
40;; Auto-Revert Mode applies to all file buffers. (If the user option 41;; Auto-Revert Mode applies to all file buffers. (If the user option
@@ -59,11 +60,19 @@
59;; Just put point at the end of the buffer and it will stay there. 60;; Just put point at the end of the buffer and it will stay there.
60;; These rules apply to file buffers. For non-file buffers, the 61;; These rules apply to file buffers. For non-file buffers, the
61;; behavior may be mode dependent. 62;; behavior may be mode dependent.
63;;
64;; While you can use Auto Revert Mode to tail a file, this package
65;; contains a third minor mode, Auto Revert Tail Mode, which does so
66;; more efficiently, as long as you are sure that the file will only
67;; change by growing at the end. It only appends the new output,
68;; instead of reverting the entire buffer. It does so even if the
69;; buffer contains unsaved changes. (Because they will not be lost.)
62 70
63;; Usage: 71;; Usage:
64;; 72;;
65;; Go to the appropriate buffer and press: 73;; Go to the appropriate buffer and press either of:
66;; M-x auto-revert-mode RET 74;; M-x auto-revert-mode RET
75;; M-x auto-revert-tail-mode RET
67;; 76;;
68;; To activate Global Auto-Revert Mode, press: 77;; To activate Global Auto-Revert Mode, press:
69;; M-x global-auto-revert-mode RET 78;; M-x global-auto-revert-mode RET
@@ -105,13 +114,18 @@ Global Auto-Revert Mode applies to all buffers."
105 114
106;; Variables: 115;; Variables:
107 116
108;; Autoload for the benefit of `make-mode-line-mouse-sensitive'. 117;;; What's this?: ;; Autoload for the benefit of `make-mode-line-mouse-sensitive'.
109;;;###autoload 118;;; What's this?: ;;;###autoload
110(defvar auto-revert-mode nil 119(defvar auto-revert-mode nil
111 "*Non-nil when Auto-Revert Mode is active. 120 "*Non-nil when Auto-Revert Mode is active.
112Never set this variable directly, use the command `auto-revert-mode' instead.") 121Never set this variable directly, use the command `auto-revert-mode' instead.")
113(put 'auto-revert-mode 'permanent-local t) 122(put 'auto-revert-mode 'permanent-local t)
114 123
124(defvar auto-revert-tail-mode nil
125 "*Non-nil when Auto-Revert Tail Mode is active.
126Never set this variable directly, use the command `auto-revert-mode' instead.")
127(put 'auto-revert-tail-mode 'permanent-local t)
128
115(defvar auto-revert-timer nil 129(defvar auto-revert-timer nil
116 "Timer used by Auto-Revert Mode.") 130 "Timer used by Auto-Revert Mode.")
117 131
@@ -153,6 +167,13 @@ When non-nil, a message is generated whenever a file is reverted."
153 :group 'auto-revert 167 :group 'auto-revert
154 :type 'string) 168 :type 'string)
155 169
170(defcustom auto-revert-tail-mode-text " Tail"
171 "String to display in the mode line when Auto-Revert Tail Mode is active.
172
173\(When the string is not empty, make sure that it has a leading space.)"
174 :group 'auto-revert
175 :type 'string)
176
156(defcustom auto-revert-mode-hook nil 177(defcustom auto-revert-mode-hook nil
157 "Functions to run when Auto-Revert Mode is activated." 178 "Functions to run when Auto-Revert Mode is activated."
158 :tag "Auto Revert Mode Hook" ; To separate it from `global-...' 179 :tag "Auto Revert Mode Hook" ; To separate it from `global-...'
@@ -190,7 +211,7 @@ For more information, see Info node `(emacs-xtra)Autorevert'."
190 :type 'boolean 211 :type 'boolean
191 :link '(info-link "(emacs-xtra)Autorevert")) 212 :link '(info-link "(emacs-xtra)Autorevert"))
192 213
193(defcustom global-auto-revert-ignore-modes '() 214(defcustom global-auto-revert-ignore-modes ()
194 "List of major modes Global Auto-Revert Mode should not check." 215 "List of major modes Global Auto-Revert Mode should not check."
195 :group 'auto-revert 216 :group 'auto-revert
196 :type '(repeat sexp)) 217 :type '(repeat sexp))
@@ -230,7 +251,7 @@ This variable becomes buffer local when set in any fashion.")
230 251
231;; Internal variables: 252;; Internal variables:
232 253
233(defvar auto-revert-buffer-list '() 254(defvar auto-revert-buffer-list ()
234 "List of buffers in Auto-Revert Mode. 255 "List of buffers in Auto-Revert Mode.
235 256
236Note that only Auto-Revert Mode, never Global Auto-Revert Mode, adds 257Note that only Auto-Revert Mode, never Global Auto-Revert Mode, adds
@@ -239,9 +260,16 @@ buffers to this list.
239The timer function `auto-revert-buffers' is responsible for purging 260The timer function `auto-revert-buffers' is responsible for purging
240the list of old buffers.") 261the list of old buffers.")
241 262
242(defvar auto-revert-remaining-buffers '() 263(defvar auto-revert-remaining-buffers ()
243 "Buffers not checked when user input stopped execution.") 264 "Buffers not checked when user input stopped execution.")
244 265
266(defvar auto-revert-tail-pos 0
267 "Position of last known end of file.")
268
269(add-hook 'find-file-hook
270 (lambda ()
271 (set (make-local-variable 'auto-revert-tail-pos)
272 (save-restriction (widen) (1- (point-max))))))
245 273
246;; Functions: 274;; Functions:
247 275
@@ -251,7 +279,9 @@ the list of old buffers.")
251 279
252With arg, turn Auto Revert mode on if and only if arg is positive. 280With arg, turn Auto Revert mode on if and only if arg is positive.
253This is a minor mode that affects only the current buffer. 281This is a minor mode that affects only the current buffer.
254Use `global-auto-revert-mode' to automatically revert all buffers." 282Use `global-auto-revert-mode' to automatically revert all buffers.
283Use `auto-revert-tail-mode' if you know that the file will only grow
284without being changed in the part that is already in the buffer."
255 nil auto-revert-mode-text nil 285 nil auto-revert-mode-text nil
256 (if auto-revert-mode 286 (if auto-revert-mode
257 (if (not (memq (current-buffer) auto-revert-buffer-list)) 287 (if (not (memq (current-buffer) auto-revert-buffer-list))
@@ -260,7 +290,8 @@ Use `global-auto-revert-mode' to automatically revert all buffers."
260 (delq (current-buffer) auto-revert-buffer-list))) 290 (delq (current-buffer) auto-revert-buffer-list)))
261 (auto-revert-set-timer) 291 (auto-revert-set-timer)
262 (when auto-revert-mode 292 (when auto-revert-mode
263 (auto-revert-buffers))) 293 (auto-revert-buffers)
294 (setq auto-revert-tail-mode nil)))
264 295
265 296
266;;;###autoload 297;;;###autoload
@@ -273,6 +304,52 @@ This function is designed to be added to hooks, for example:
273 304
274 305
275;;;###autoload 306;;;###autoload
307(define-minor-mode auto-revert-tail-mode
308 "Toggle reverting tail of buffer when file on disk grows.
309With arg, turn Tail mode on iff arg is positive.
310
311When Tail mode is enabled, the tail of the file is constantly
312followed, as with the shell command `tail -f'. This means that
313whenever the file grows on disk (presumably because some
314background process is appending to it from time to time), this is
315reflected in the current buffer.
316
317You can edit the buffer and turn this mode off and on again as
318you please. But make sure the background process has stopped
319writing before you save the file!
320
321Use `auto-revert-mode' for changes other than appends!"
322 :group 'find-file :lighter auto-revert-tail-mode-text
323 (when auto-revert-tail-mode
324 (unless buffer-file-name
325 (auto-revert-tail-mode 0)
326 (error "This buffer is not visiting a file"))
327 (if (and (buffer-modified-p)
328 (not auto-revert-tail-pos) ; library was loaded only after finding file
329 (not (y-or-n-p "Buffer is modified, so tail offset may be wrong. Proceed? ")))
330 (auto-revert-tail-mode 0)
331 ;; else we might reappend our own end when we save
332 (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t)
333 (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position
334 (set (make-variable-buffer-local 'auto-revert-tail-pos)
335 (save-restriction (widen) (1- (point-max)))))
336 ;; let auto-revert-mode set up the mechanism for us if it isn't already
337 (or auto-revert-mode
338 (let ((auto-revert-tail-mode t))
339 (auto-revert-mode 1)))
340 (setq auto-revert-mode nil))))
341
342
343;;;###autoload
344(defun turn-on-auto-revert-tail-mode ()
345 "Turn on Auto-Revert Tail Mode.
346
347This function is designed to be added to hooks, for example:
348 (add-hook 'my-logfile-mode-hook 'turn-on-auto-revert-tail-mode)"
349 (auto-revert-tail-mode 1))
350
351
352;;;###autoload
276(define-minor-mode global-auto-revert-mode 353(define-minor-mode global-auto-revert-mode
277 "Revert any buffer when file on disk changes. 354 "Revert any buffer when file on disk changes.
278 355
@@ -298,12 +375,12 @@ will use an up-to-date value of `auto-revert-interval'"
298 (if (or global-auto-revert-mode auto-revert-buffer-list) 375 (if (or global-auto-revert-mode auto-revert-buffer-list)
299 (run-with-timer auto-revert-interval 376 (run-with-timer auto-revert-interval
300 auto-revert-interval 377 auto-revert-interval
301 'auto-revert-buffers) 378 'auto-revert-buffers))))
302 nil)))
303 379
304(defun auto-revert-active-p () 380(defun auto-revert-active-p ()
305 "Check if auto-revert is active (in current buffer or globally)." 381 "Check if auto-revert is active (in current buffer or globally)."
306 (or auto-revert-mode 382 (or auto-revert-mode
383 auto-revert-tail-mode
307 (and 384 (and
308 global-auto-revert-mode 385 global-auto-revert-mode
309 (not global-auto-revert-ignore-buffer) 386 (not global-auto-revert-ignore-buffer)
@@ -313,18 +390,20 @@ will use an up-to-date value of `auto-revert-interval'"
313(defun auto-revert-handler () 390(defun auto-revert-handler ()
314 "Revert current buffer, if appropriate. 391 "Revert current buffer, if appropriate.
315This is an internal function used by Auto-Revert Mode." 392This is an internal function used by Auto-Revert Mode."
316 (unless (buffer-modified-p) 393 (when (or auto-revert-tail-mode (not (buffer-modified-p)))
317 (let ((buffer (current-buffer)) revert eob eoblist) 394 (let* ((buffer (current-buffer))
318 (or (and buffer-file-name 395 (revert
319 (not (file-remote-p buffer-file-name)) 396 (or (and buffer-file-name
320 (file-readable-p buffer-file-name) 397 (not (file-remote-p buffer-file-name))
321 (not (verify-visited-file-modtime buffer)) 398 (file-readable-p buffer-file-name)
322 (setq revert t)) 399 (not (verify-visited-file-modtime buffer)))
323 (and (or auto-revert-mode global-auto-revert-non-file-buffers) 400 (and (or auto-revert-mode
324 revert-buffer-function 401 global-auto-revert-non-file-buffers)
325 (boundp 'buffer-stale-function) 402 revert-buffer-function
326 (functionp buffer-stale-function) 403 (boundp 'buffer-stale-function)
327 (setq revert (funcall buffer-stale-function t)))) 404 (functionp buffer-stale-function)
405 (funcall buffer-stale-function t))))
406 eob eoblist)
328 (when revert 407 (when revert
329 (when (and auto-revert-verbose 408 (when (and auto-revert-verbose
330 (not (eq revert 'fast))) 409 (not (eq revert 'fast)))
@@ -340,7 +419,9 @@ This is an internal function used by Auto-Revert Mode."
340 (= (window-point window) (point-max)) 419 (= (window-point window) (point-max))
341 (push window eoblist))) 420 (push window eoblist)))
342 'no-mini t)) 421 'no-mini t))
343 (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes) 422 (if auto-revert-tail-mode
423 (auto-revert-tail-handler)
424 (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))
344 (when buffer-file-name 425 (when buffer-file-name
345 (when eob (goto-char (point-max))) 426 (when eob (goto-char (point-max)))
346 (dolist (window eoblist) 427 (dolist (window eoblist)
@@ -350,6 +431,22 @@ This is an internal function used by Auto-Revert Mode."
350 (when (or revert auto-revert-check-vc-info) 431 (when (or revert auto-revert-check-vc-info)
351 (vc-find-file-hook))))) 432 (vc-find-file-hook)))))
352 433
434(defun auto-revert-tail-handler ()
435 (let ((size (nth 7 (file-attributes buffer-file-name)))
436 (modified (buffer-modified-p))
437 buffer-read-only ; ignore
438 (file buffer-file-name)
439 buffer-file-name) ; ignore that file has changed
440 (when (> size auto-revert-tail-pos)
441 (save-restriction
442 (widen)
443 (save-excursion
444 (goto-char (point-max))
445 (insert-file-contents file nil auto-revert-tail-pos size)))
446 (setq auto-revert-tail-pos size)
447 (set-buffer-modified-p modified)))
448 (set-visited-file-modtime))
449
353(defun auto-revert-buffers () 450(defun auto-revert-buffers ()
354 "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode. 451 "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode.
355 452
@@ -376,8 +473,8 @@ the timer when no buffers need to be checked."
376 (let ((bufs (if global-auto-revert-mode 473 (let ((bufs (if global-auto-revert-mode
377 (buffer-list) 474 (buffer-list)
378 auto-revert-buffer-list)) 475 auto-revert-buffer-list))
379 (remaining '()) 476 (remaining ())
380 (new '())) 477 (new ()))
381 ;; Partition `bufs' into two halves depending on whether or not 478 ;; Partition `bufs' into two halves depending on whether or not
382 ;; the buffers are in `auto-revert-remaining-buffers'. The two 479 ;; the buffers are in `auto-revert-remaining-buffers'. The two
383 ;; halves are then re-joined with the "remaining" buffers at the 480 ;; halves are then re-joined with the "remaining" buffers at the
@@ -398,6 +495,7 @@ the timer when no buffers need to be checked."
398 ;; Test if someone has turned off Auto-Revert Mode in a 495 ;; Test if someone has turned off Auto-Revert Mode in a
399 ;; non-standard way, for example by changing major mode. 496 ;; non-standard way, for example by changing major mode.
400 (if (and (not auto-revert-mode) 497 (if (and (not auto-revert-mode)
498 (not auto-revert-tail-mode)
401 (memq buf auto-revert-buffer-list)) 499 (memq buf auto-revert-buffer-list))
402 (setq auto-revert-buffer-list 500 (setq auto-revert-buffer-list
403 (delq buf auto-revert-buffer-list))) 501 (delq buf auto-revert-buffer-list)))
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 68c4ec433f7..eab0d596764 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -404,12 +404,12 @@ Menu of mode operations in the mode line.")
404(define-key mode-line-mode-menu [highlight-changes-mode] 404(define-key mode-line-mode-menu [highlight-changes-mode]
405 `(menu-item ,(purecopy "Highlight changes (Chg)") highlight-changes-mode 405 `(menu-item ,(purecopy "Highlight changes (Chg)") highlight-changes-mode
406 :button (:toggle . highlight-changes-mode))) 406 :button (:toggle . highlight-changes-mode)))
407(define-key mode-line-mode-menu [glasses-mode]
408 `(menu-item ,(purecopy "Glasses (o^o)") glasses-mode
409 :button (:toggle . (bound-and-true-p glasses-mode))))
410(define-key mode-line-mode-menu [hide-ifdef-mode] 407(define-key mode-line-mode-menu [hide-ifdef-mode]
411 `(menu-item ,(purecopy "Hide ifdef (Ifdef)") hide-ifdef-mode 408 `(menu-item ,(purecopy "Hide ifdef (Ifdef)") hide-ifdef-mode
412 :button (:toggle . (bound-and-true-p hide-ifdef-mode)))) 409 :button (:toggle . (bound-and-true-p hide-ifdef-mode))))
410(define-key mode-line-mode-menu [glasses-mode]
411 `(menu-item ,(purecopy "Glasses (o^o)") glasses-mode
412 :button (:toggle . (bound-and-true-p glasses-mode))))
413(define-key mode-line-mode-menu [font-lock-mode] 413(define-key mode-line-mode-menu [font-lock-mode]
414 `(menu-item ,(purecopy "Font Lock") font-lock-mode 414 `(menu-item ,(purecopy "Font Lock") font-lock-mode
415 :button (:toggle . font-lock-mode))) 415 :button (:toggle . font-lock-mode)))
@@ -419,12 +419,15 @@ Menu of mode operations in the mode line.")
419(define-key mode-line-mode-menu [column-number-mode] 419(define-key mode-line-mode-menu [column-number-mode]
420 `(menu-item ,(purecopy "Column number") column-number-mode 420 `(menu-item ,(purecopy "Column number") column-number-mode
421 :button (:toggle . column-number-mode))) 421 :button (:toggle . column-number-mode)))
422(define-key mode-line-mode-menu [auto-fill-mode] 422(define-key mode-line-mode-menu [auto-revert-tail-mode]
423 `(menu-item ,(purecopy "Auto Fill (Fill)") auto-fill-mode 423 `(menu-item ,(purecopy "Auto revert tail (Tail)") auto-revert-tail-mode
424 :button (:toggle . auto-fill-function))) 424 :button (:toggle . auto-revert-tail-mode)))
425(define-key mode-line-mode-menu [auto-revert-mode] 425(define-key mode-line-mode-menu [auto-revert-mode]
426 `(menu-item ,(purecopy "Auto revert (ARev)") auto-revert-mode 426 `(menu-item ,(purecopy "Auto revert (ARev)") auto-revert-mode
427 :button (:toggle . auto-revert-mode))) 427 :button (:toggle . auto-revert-mode)))
428(define-key mode-line-mode-menu [auto-fill-mode]
429 `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode
430 :button (:toggle . auto-fill-function)))
428(define-key mode-line-mode-menu [abbrev-mode] 431(define-key mode-line-mode-menu [abbrev-mode]
429 `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode 432 `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode
430 :button (:toggle . abbrev-mode))) 433 :button (:toggle . abbrev-mode)))
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index da1c8ed586e..1ccaab1c6a3 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -613,7 +613,7 @@ For more information, see the function `buffer-menu'."
613 " " 613 " "
614 (Buffer-menu-make-sort-button "Mode" 4) mode-end 614 (Buffer-menu-make-sort-button "Mode" 4) mode-end
615 (Buffer-menu-make-sort-button "File" 5) "\n")) 615 (Buffer-menu-make-sort-button "File" 5) "\n"))
616 list desired-point name file) 616 list desired-point name mode file)
617 (when Buffer-menu-use-header-line 617 (when Buffer-menu-use-header-line
618 (let ((pos 0)) 618 (let ((pos 0))
619 ;; Turn spaces in the header into stretch specs so they work 619 ;; Turn spaces in the header into stretch specs so they work
@@ -638,8 +638,14 @@ For more information, see the function `buffer-menu'."
638 (mapcar 638 (mapcar
639 (lambda (buffer) 639 (lambda (buffer)
640 (with-current-buffer buffer 640 (with-current-buffer buffer
641 (setq name (buffer-name) 641 (save-window-excursion
642 file (buffer-file-name)) 642 (setq name (buffer-name)
643 mode (progn
644 (set-window-buffer (selected-window) buffer)
645 (concat (format-mode-line mode-name)
646 (if mode-line-process
647 (format-mode-line mode-line-process))))
648 file (buffer-file-name)))
643 (cond 649 (cond
644 ;; Don't mention internal buffers. 650 ;; Don't mention internal buffers.
645 ((and (string= (substring name 0 1) " ") (null file))) 651 ((and (string= (substring name 0 1) " ") (null file)))
@@ -665,7 +671,7 @@ For more information, see the function `buffer-menu'."
665 ?% ? ) 671 ?% ? )
666 ;; Identify modified buffers. 672 ;; Identify modified buffers.
667 (if (buffer-modified-p) ?* ? )) 673 (if (buffer-modified-p) ?* ? ))
668 name (buffer-size) mode-name file))))) 674 name (buffer-size) mode file)))))
669 (buffer-list)))) 675 (buffer-list))))
670 (dolist (buffer 676 (dolist (buffer
671 (if Buffer-menu-sort-column 677 (if Buffer-menu-sort-column
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index 68943b77b28..034e8e28523 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -70,14 +70,14 @@ absolute date ABS-DATE is the equivalent moment to X."
70(defun calendar-time-from-absolute (abs-date s) 70(defun calendar-time-from-absolute (abs-date s)
71 "Time of absolute date ABS-DATE, S seconds after midnight. 71 "Time of absolute date ABS-DATE, S seconds after midnight.
72 72
73Returns the pair (HIGH . LOW) where HIGH and LOW are the high and low 73Returns the list (HIGH LOW) where HIGH and LOW are the high and low
7416 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC, 7416 bits, respectively, of the number of seconds 1970-01-01 00:00:00 UTC,
75ignoring leap seconds, that is the equivalent moment to S seconds after 75ignoring leap seconds, that is the equivalent moment to S seconds after
76midnight UTC on absolute date ABS-DATE." 76midnight UTC on absolute date ABS-DATE."
77 (let* ((a (- abs-date calendar-system-time-basis)) 77 (let* ((a (- abs-date calendar-system-time-basis))
78 (u (+ (* 163 (mod a 512)) (floor s 128)))) 78 (u (+ (* 163 (mod a 512)) (floor s 128))))
79 ;; Overflow is a terrible thing! 79 ;; Overflow is a terrible thing!
80 (cons 80 (list
81 ;; floor((60*60*24*a + s) / 2^16) 81 ;; floor((60*60*24*a + s) / 2^16)
82 (+ a (* 163 (floor a 512)) (floor u 512)) 82 (+ a (* 163 (floor a 512)) (floor u 512))
83 ;; (60*60*24*a + s) mod 2^16 83 ;; (60*60*24*a + s) mod 2^16
diff --git a/lisp/dired.el b/lisp/dired.el
index e5e23dfe2d6..43eec9408d4 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -620,8 +620,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
620 (modtime (visited-file-modtime))) 620 (modtime (visited-file-modtime)))
621 (or (eq modtime 0) 621 (or (eq modtime 0)
622 (not (eq (car attributes) t)) 622 (not (eq (car attributes) t))
623 (and (= (car (nth 5 attributes)) (car modtime)) 623 (equal (nth 5 attributes) modtime)))))
624 (= (nth 1 (nth 5 attributes)) (cdr modtime)))))))
625 624
626(defun dired-buffer-stale-p (&optional noconfirm) 625(defun dired-buffer-stale-p (&optional noconfirm)
627 "Return non-nil if current dired buffer needs updating. 626 "Return non-nil if current dired buffer needs updating.
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index 547e2cbd32d..23e9a54b1bb 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -38,9 +38,9 @@
38;; instrumentation callbacks, then replace edebug's callbacks with ours. 38;; instrumentation callbacks, then replace edebug's callbacks with ours.
39;; * To show good coverage, we want to see two values for every form, except 39;; * To show good coverage, we want to see two values for every form, except
40;; functions that always return the same value and `defconst' variables 40;; functions that always return the same value and `defconst' variables
41;; need show only value for good coverage. To avoid the brown splotch, the 41;; need show only one value for good coverage. To avoid the brown
42;; definitions for constants and 1-valued functions must precede the 42;; splotch, the definitions for constants and 1-valued functions must
43;; references. 43;; precede the references.
44;; * Use the macro `1value' in your Lisp code to mark spots where the local 44;; * Use the macro `1value' in your Lisp code to mark spots where the local
45;; code environment causes a function or variable to always have the same 45;; code environment causes a function or variable to always have the same
46;; value, but the function or variable is not intrinsically 1-valued. 46;; value, but the function or variable is not intrinsically 1-valued.
@@ -55,12 +55,14 @@
55;; call has the same value! Also, equal thinks two strings are the same 55;; call has the same value! Also, equal thinks two strings are the same
56;; if they differ only in properties. 56;; if they differ only in properties.
57;; * Because we have only a "1value" class and no "always nil" class, we have 57;; * Because we have only a "1value" class and no "always nil" class, we have
58;; to treat as 1-valued any `and' whose last term is 1-valued, in case the 58;; to treat as potentially 1-valued any `and' whose last term is 1-valued,
59;; last term is always nil. Example: 59;; in case the last term is always nil. Example:
60;; (and (< (point) 1000) (forward-char 10)) 60;; (and (< (point) 1000) (forward-char 10))
61;; This form always returns nil. Similarly, `if' and `cond' are 61;; This form always returns nil. Similarly, `or', `if', and `cond' are
62;; treated as 1-valued if all clauses are, in case those values are 62;; treated as potentially 1-valued if all clauses are, in case those
63;; always nil. 63;; values are always nil. Unlike truly 1-valued functions, it is not an
64;; error if these "potentially" 1-valued forms actually return differing
65;; values.
64 66
65(require 'edebug) 67(require 'edebug)
66(provide 'testcover) 68(provide 'testcover)
@@ -86,12 +88,14 @@ these. This list is quite incomplete!"
86 88
87(defcustom testcover-1value-functions 89(defcustom testcover-1value-functions
88 '(backward-char barf-if-buffer-read-only beginning-of-line 90 '(backward-char barf-if-buffer-read-only beginning-of-line
89 buffer-disable-undo buffer-enable-undo current-global-map deactivate-mark 91 buffer-disable-undo buffer-enable-undo current-global-map
90 delete-char delete-region ding error forward-char function* insert 92 deactivate-mark delete-backward-char delete-char delete-region ding
91 insert-and-inherit kill-all-local-variables lambda mapc narrow-to-region 93 forward-char function* insert insert-and-inherit kill-all-local-variables
92 noreturn push-mark put-text-property run-hooks set-text-properties signal 94 kill-line kill-paragraph kill-region kill-sexp lambda
93 substitute-key-definition suppress-keymap throw undo use-local-map while 95 minibuffer-complete-and-exit narrow-to-region next-line push-mark
94 widen yank) 96 put-text-property run-hooks set-match-data signal
97 substitute-key-definition suppress-keymap undo use-local-map while widen
98 yank)
95 "Functions that always return the same value. No brown splotch is shown 99 "Functions that always return the same value. No brown splotch is shown
96for these. This list is quite incomplete! Notes: Nobody ever changes the 100for these. This list is quite incomplete! Notes: Nobody ever changes the
97current global map. The macro `lambda' is self-evaluating, hence always 101current global map. The macro `lambda' is self-evaluating, hence always
@@ -108,9 +112,9 @@ them as having returned nil just before calling them."
108 :type 'hook) 112 :type 'hook)
109 113
110(defcustom testcover-compose-functions 114(defcustom testcover-compose-functions
111 '(+ - * / length list make-keymap make-sparse-keymap message propertize 115 '(+ - * / = append length list make-keymap make-sparse-keymap
112 replace-regexp-in-string run-with-idle-timer 116 mapcar message propertize replace-regexp-in-string
113 set-buffer-modified-p) 117 run-with-idle-timer set-buffer-modified-p)
114 "Functions that are 1-valued if all their args are either constants or 118 "Functions that are 1-valued if all their args are either constants or
115calls to one of the `testcover-1value-functions', so if that's true then no 119calls to one of the `testcover-1value-functions', so if that's true then no
116brown splotch is shown for these. This list is quite incomplete! Most 120brown splotch is shown for these. This list is quite incomplete! Most
@@ -119,16 +123,16 @@ side-effect-free functions should be here."
119 :type 'hook) 123 :type 'hook)
120 124
121(defcustom testcover-progn-functions 125(defcustom testcover-progn-functions
122 '(define-key fset function goto-char or overlay-put progn save-current-buffer 126 '(define-key fset function goto-char mapc overlay-put progn
123 save-excursion save-match-data save-restriction save-selected-window 127 save-current-buffer save-excursion save-match-data
124 save-window-excursion set set-default setq setq-default 128 save-restriction save-selected-window save-window-excursion
125 with-output-to-temp-buffer with-syntax-table with-temp-buffer 129 set set-default set-marker-insertion-type setq setq-default
126 with-temp-file with-temp-message with-timeout) 130 with-current-buffer with-output-to-temp-buffer with-syntax-table
131 with-temp-buffer with-temp-file with-temp-message with-timeout)
127 "Functions whose return value is the same as their last argument. No 132 "Functions whose return value is the same as their last argument. No
128brown splotch is shown for these if the last argument is a constant or a 133brown splotch is shown for these if the last argument is a constant or a
129call to one of the `testcover-1value-functions'. This list is probably 134call to one of the `testcover-1value-functions'. This list is probably
130incomplete! Note: `or' is here in case the last argument is a function that 135incomplete!"
131always returns nil."
132 :group 'testcover 136 :group 'testcover
133 :type 'hook) 137 :type 'hook)
134 138
@@ -140,6 +144,11 @@ call to one of the `testcover-1value-functions'."
140 :group 'testcover 144 :group 'testcover
141 :type 'hook) 145 :type 'hook)
142 146
147(defcustom testcover-potentially-1value-functions
148 '(add-hook and beep or remove-hook unless when)
149 "Functions that are potentially 1-valued. No brown splotch if actually
1501-valued, no error if actually multi-valued.")
151
143(defface testcover-nohits-face 152(defface testcover-nohits-face
144 '((t (:background "DeepPink2"))) 153 '((t (:background "DeepPink2")))
145 "Face for forms that had no hits during coverage test" 154 "Face for forms that had no hits during coverage test"
@@ -161,7 +170,11 @@ call to one of the `testcover-1value-functions'."
161 170
162(defvar testcover-module-1value-functions nil 171(defvar testcover-module-1value-functions nil
163 "Symbols declared with defun in the last file processed by 172 "Symbols declared with defun in the last file processed by
164`testcover-start', whose functions always return the same value.") 173`testcover-start', whose functions should always return the same value.")
174
175(defvar testcover-module-potentially-1value-functions nil
176 "Symbols declared with defun in the last file processed by
177`testcover-start', whose functions might always return the same value.")
165 178
166(defvar testcover-vector nil 179(defvar testcover-vector nil
167 "Locally bound to coverage vector for function in progress.") 180 "Locally bound to coverage vector for function in progress.")
@@ -206,25 +219,32 @@ non-nil, byte-compiles each function after instrumenting."
206 x)) 219 x))
207 220
208(defun testcover-reinstrument (form) 221(defun testcover-reinstrument (form)
209 "Reinstruments FORM to use testcover instead of edebug. This function 222 "Reinstruments FORM to use testcover instead of edebug. This
210modifies the list that FORM points to. Result is non-nil if FORM will 223function modifies the list that FORM points to. Result is nil if
211always return the same value." 224FORM should return multiple vlues, t if should always return same
225value, 'maybe if either is acceptable."
212 (let ((fun (car-safe form)) 226 (let ((fun (car-safe form))
213 id) 227 id val)
214 (cond 228 (cond
215 ((not fun) ;Atom 229 ((not fun) ;Atom
216 (or (not (symbolp form)) 230 (when (or (not (symbolp form))
217 (memq form testcover-constants) 231 (memq form testcover-constants)
218 (memq form testcover-module-constants))) 232 (memq form testcover-module-constants))
219 ((consp fun) ;Embedded list 233 t))
234 ((consp fun) ;Embedded list
220 (testcover-reinstrument fun) 235 (testcover-reinstrument fun)
221 (testcover-reinstrument-list (cdr form)) 236 (testcover-reinstrument-list (cdr form))
222 nil) 237 nil)
223 ((or (memq fun testcover-1value-functions) 238 ((or (memq fun testcover-1value-functions)
224 (memq fun testcover-module-1value-functions)) 239 (memq fun testcover-module-1value-functions))
225 ;;Always return same value 240 ;;Should always return same value
226 (testcover-reinstrument-list (cdr form)) 241 (testcover-reinstrument-list (cdr form))
227 t) 242 t)
243 ((or (memq fun testcover-potentially-1value-functions)
244 (memq fun testcover-module-potentially-1value-functions))
245 ;;Might always return same value
246 (testcover-reinstrument-list (cdr form))
247 'maybe)
228 ((memq fun testcover-progn-functions) 248 ((memq fun testcover-progn-functions)
229 ;;1-valued if last argument is 249 ;;1-valued if last argument is
230 (testcover-reinstrument-list (cdr form))) 250 (testcover-reinstrument-list (cdr form)))
@@ -233,11 +253,9 @@ always return the same value."
233 (testcover-reinstrument-list (cddr form)) 253 (testcover-reinstrument-list (cddr form))
234 (testcover-reinstrument (cadr form))) 254 (testcover-reinstrument (cadr form)))
235 ((memq fun testcover-compose-functions) 255 ((memq fun testcover-compose-functions)
236 ;;1-valued if all arguments are 256 ;;1-valued if all arguments are. Potentially 1-valued if all
237 (setq id t) 257 ;;arguments are either definitely or potentially.
238 (mapc #'(lambda (x) (setq id (or (testcover-reinstrument x) id))) 258 (testcover-reinstrument-compose (cdr form) 'testcover-reinstrument))
239 (cdr form))
240 id)
241 ((eq fun 'edebug-enter) 259 ((eq fun 'edebug-enter)
242 ;;(edebug-enter 'SYM ARGS #'(lambda nil FORMS)) 260 ;;(edebug-enter 'SYM ARGS #'(lambda nil FORMS))
243 ;; => (testcover-enter 'SYM #'(lambda nil FORMS)) 261 ;; => (testcover-enter 'SYM #'(lambda nil FORMS))
@@ -252,33 +270,44 @@ always return the same value."
252 (aset testcover-vector (cadr (cadr form)) 'ok-coverage)) 270 (aset testcover-vector (cadr (cadr form)) 'ok-coverage))
253 (setq id (nth 2 form)) 271 (setq id (nth 2 form))
254 (setcdr form (nthcdr 2 form)) 272 (setcdr form (nthcdr 2 form))
273 (setq val (testcover-reinstrument (nth 2 form)))
274 (if (eq val t)
275 (setcar form 'testcover-1value)
276 (setcar form 'testcover-after))
277 (when val
278 ;;1-valued or potentially 1-valued
279 (aset testcover-vector id '1value))
255 (cond 280 (cond
256 ((memq (car-safe (nth 2 form)) testcover-noreturn-functions) 281 ((memq (car-safe (nth 2 form)) testcover-noreturn-functions)
257 ;;This function won't return, so set the value in advance 282 ;;This function won't return, so set the value in advance
258 ;;(edebug-after (edebug-before XXX) YYY FORM) 283 ;;(edebug-after (edebug-before XXX) YYY FORM)
259 ;; => (progn (edebug-after YYY nil) FORM) 284 ;; => (progn (edebug-after YYY nil) FORM)
285 (setcar (cdr form) `(,(car form) ,id nil))
260 (setcar form 'progn) 286 (setcar form 'progn)
261 (setcar (cdr form) `(testcover-after ,id nil))) 287 (aset testcover-vector id '1value)
288 (setq val t))
262 ((eq (car-safe (nth 2 form)) '1value) 289 ((eq (car-safe (nth 2 form)) '1value)
263 ;;This function is always supposed to return the same value 290 ;;This function is always supposed to return the same value
264 (setcar form 'testcover-1value)) 291 (setq val t)
265 (t 292 (aset testcover-vector id '1value)
266 (setcar form 'testcover-after))) 293 (setcar form 'testcover-1value)))
267 (when (testcover-reinstrument (nth 2 form)) 294 val)
268 (aset testcover-vector id '1value)))
269 ((eq fun 'defun) 295 ((eq fun 'defun)
270 (if (testcover-reinstrument-list (nthcdr 3 form)) 296 (setq val (testcover-reinstrument-list (nthcdr 3 form)))
271 (push (cadr form) testcover-module-1value-functions))) 297 (when (eq val t)
272 ((eq fun 'defconst) 298 (push (cadr form) testcover-module-1value-functions))
299 (when (eq val 'maybe)
300 (push (cadr form) testcover-module-potentially-1value-functions)))
301 ((memq fun '(defconst defcustom))
273 ;;Define this symbol as 1-valued 302 ;;Define this symbol as 1-valued
274 (push (cadr form) testcover-module-constants) 303 (push (cadr form) testcover-module-constants)
275 (testcover-reinstrument-list (cddr form))) 304 (testcover-reinstrument-list (cddr form)))
276 ((memq fun '(dotimes dolist)) 305 ((memq fun '(dotimes dolist))
277 ;;Always returns third value from SPEC 306 ;;Always returns third value from SPEC
278 (testcover-reinstrument-list (cddr form)) 307 (testcover-reinstrument-list (cddr form))
279 (setq fun (testcover-reinstrument-list (cadr form))) 308 (setq val (testcover-reinstrument-list (cadr form)))
280 (if (nth 2 (cadr form)) 309 (if (nth 2 (cadr form))
281 fun 310 val
282 ;;No third value, always returns nil 311 ;;No third value, always returns nil
283 t)) 312 t))
284 ((memq fun '(let let*)) 313 ((memq fun '(let let*))
@@ -286,23 +315,23 @@ always return the same value."
286 (mapc 'testcover-reinstrument-list (cadr form)) 315 (mapc 'testcover-reinstrument-list (cadr form))
287 (testcover-reinstrument-list (cddr form))) 316 (testcover-reinstrument-list (cddr form)))
288 ((eq fun 'if) 317 ((eq fun 'if)
289 ;;1-valued if both THEN and ELSE clauses are 318 ;;Potentially 1-valued if both THEN and ELSE clauses are
290 (testcover-reinstrument (cadr form)) 319 (testcover-reinstrument (cadr form))
291 (let ((then (testcover-reinstrument (nth 2 form))) 320 (let ((then (testcover-reinstrument (nth 2 form)))
292 (else (testcover-reinstrument-list (nthcdr 3 form)))) 321 (else (testcover-reinstrument-list (nthcdr 3 form))))
293 (and then else))) 322 (and then else 'maybe)))
294 ((memq fun '(when unless and))
295 ;;1-valued if last clause of BODY is
296 (testcover-reinstrument-list (cdr form)))
297 ((eq fun 'cond) 323 ((eq fun 'cond)
298 ;;1-valued if all clauses are 324 ;;Potentially 1-valued if all clauses are
299 (testcover-reinstrument-clauses (cdr form))) 325 (when (testcover-reinstrument-compose (cdr form)
326 'testcover-reinstrument-list)
327 'maybe))
300 ((eq fun 'condition-case) 328 ((eq fun 'condition-case)
301 ;;1-valued if BODYFORM is and all HANDLERS are 329 ;;Potentially 1-valued if BODYFORM is and all HANDLERS are
302 (let ((body (testcover-reinstrument (nth 2 form))) 330 (let ((body (testcover-reinstrument (nth 2 form)))
303 (errs (testcover-reinstrument-clauses (mapcar #'cdr 331 (errs (testcover-reinstrument-compose
304 (nthcdr 3 form))))) 332 (mapcar #'cdr (nthcdr 3 form))
305 (and body errs))) 333 'testcover-reinstrument-list)))
334 (and body errs 'maybe)))
306 ((eq fun 'quote) 335 ((eq fun 'quote)
307 ;;Don't reinstrument what's inside! 336 ;;Don't reinstrument what's inside!
308 ;;This doesn't apply within a backquote 337 ;;This doesn't apply within a backquote
@@ -317,16 +346,55 @@ always return the same value."
317 (let ((testcover-1value-functions 346 (let ((testcover-1value-functions
318 (remq 'quote testcover-1value-functions))) 347 (remq 'quote testcover-1value-functions)))
319 (testcover-reinstrument (cadr form)))) 348 (testcover-reinstrument (cadr form))))
320 ((memq fun '(1value noreturn)) 349 ((eq fun '1value)
321 ;;Hack - pretend the arg is 1-valued here 350 ;;Hack - pretend the arg is 1-valued here
322 (if (symbolp (cadr form)) ;A pseudoconstant variable 351 (cond
323 t 352 ((symbolp (cadr form))
353 ;;A pseudoconstant variable
354 t)
355 ((and (eq (car (cadr form)) 'edebug-after)
356 (symbolp (nth 3 (cadr form))))
357 ;;Reference to pseudoconstant
358 (aset testcover-vector (nth 2 (cadr form)) '1value)
359 (setcar (cdr form) `(testcover-1value ,(nth 2 (cadr form))
360 ,(nth 3 (cadr form))))
361 t)
362 (t
324 (if (eq (car (cadr form)) 'edebug-after) 363 (if (eq (car (cadr form)) 'edebug-after)
325 (setq id (car (nth 3 (cadr form)))) 364 (setq id (car (nth 3 (cadr form))))
326 (setq id (car (cadr form)))) 365 (setq id (car (cadr form))))
327 (let ((testcover-1value-functions 366 (let ((testcover-1value-functions
328 (cons id testcover-1value-functions))) 367 (cons id testcover-1value-functions)))
329 (testcover-reinstrument (cadr form))))) 368 (testcover-reinstrument (cadr form))))))
369 ((eq fun 'noreturn)
370 ;;Hack - pretend the arg has no return
371 (cond
372 ((symbolp (cadr form))
373 ;;A pseudoconstant variable
374 'maybe)
375 ((and (eq (car (cadr form)) 'edebug-after)
376 (symbolp (nth 3 (cadr form))))
377 ;;Reference to pseudoconstant
378 (aset testcover-vector (nth 2 (cadr form)) '1value)
379 (setcar (cdr form) `(progn (testcover-after ,(nth 2 (cadr form)) nil)
380 ,(nth 3 (cadr form))))
381 'maybe)
382 (t
383 (if (eq (car (cadr form)) 'edebug-after)
384 (setq id (car (nth 3 (cadr form))))
385 (setq id (car (cadr form))))
386 (let ((testcover-noreturn-functions
387 (cons id testcover-noreturn-functions)))
388 (testcover-reinstrument (cadr form))))))
389 ((and (eq fun 'apply)
390 (eq (car-safe (cadr form)) 'quote)
391 (symbolp (cadr (cadr form))))
392 ;;Apply of a constant symbol. Process as 1value or noreturn
393 ;;depending on symbol.
394 (setq fun (cons (cadr (cadr form)) (cddr form))
395 val (testcover-reinstrument fun))
396 (setcdr (cdr form) (cdr fun))
397 val)
330 (t ;Some other function or weird thing 398 (t ;Some other function or weird thing
331 (testcover-reinstrument-list (cdr form)) 399 (testcover-reinstrument-list (cdr form))
332 nil)))) 400 nil))))
@@ -341,13 +409,22 @@ always be nil, so we return t for 1-valued."
341 (setq result (testcover-reinstrument (pop list)))) 409 (setq result (testcover-reinstrument (pop list))))
342 result)) 410 result))
343 411
344(defun testcover-reinstrument-clauses (clauselist) 412(defun testcover-reinstrument-compose (list fun)
345 "Reinstrument each list in CLAUSELIST. 413 "For a compositional function, the result is 1-valued if all
346Result is t if every clause is 1-valued." 414arguments are, potentially 1-valued if all arguments are either
415definitely or potentially 1-valued, and multi-valued otherwise.
416FUN should be `testcover-reinstrument' for compositional functions,
417 `testcover-reinstrument-list' for clauses in a `cond'."
347 (let ((result t)) 418 (let ((result t))
348 (mapc #'(lambda (x) 419 (mapc #'(lambda (x)
349 (setq result (and (testcover-reinstrument-list x) result))) 420 (setq x (funcall fun x))
350 clauselist) 421 (cond
422 ((eq result t)
423 (setq result x))
424 ((eq result 'maybe)
425 (when (not x)
426 (setq result nil)))))
427 list)
351 result)) 428 result))
352 429
353(defun testcover-end (buffer) 430(defun testcover-end (buffer)
@@ -387,7 +464,7 @@ same value during coverage testing."
387 (aset testcover-vector idx (cons '1value val))) 464 (aset testcover-vector idx (cons '1value val)))
388 ((not (and (eq (car-safe (aref testcover-vector idx)) '1value) 465 ((not (and (eq (car-safe (aref testcover-vector idx)) '1value)
389 (equal (cdr (aref testcover-vector idx)) val))) 466 (equal (cdr (aref testcover-vector idx)) val)))
390 (error "Value of form marked with `1value' does vary."))) 467 (error "Value of form marked with `1value' does vary: %s" val)))
391 val) 468 val)
392 469
393 470
@@ -415,7 +492,7 @@ eliminated by adding more test cases."
415 ov j item) 492 ov j item)
416 (or (and def-mark points coverage) 493 (or (and def-mark points coverage)
417 (error "Missing edebug data for function %s" def)) 494 (error "Missing edebug data for function %s" def))
418 (when len 495 (when (> len 0)
419 (set-buffer (marker-buffer def-mark)) 496 (set-buffer (marker-buffer def-mark))
420 (mapc 'delete-overlay 497 (mapc 'delete-overlay
421 (overlays-in def-mark (+ def-mark (aref points (1- len)) 1))) 498 (overlays-in def-mark (+ def-mark (aref points (1- len)) 1)))
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 51b47b104d0..b39945c7712 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -974,6 +974,13 @@ Extra commands should be added to `cua-movement-commands'")
974(defvar cua-movement-commands nil 974(defvar cua-movement-commands nil
975 "User may add additional movement commands to this list.") 975 "User may add additional movement commands to this list.")
976 976
977(defvar cua--preserve-mark-commands
978 '(end-of-buffer beginning-of-buffer)
979 "List of movement commands that move the mark.
980CUA will preserve the previous mark position if a mark is already
981active before one of these commands is executed.")
982
983(defvar cua--undo-push-mark nil)
977 984
978;;; Scrolling commands which does not signal errors at top/bottom 985;;; Scrolling commands which does not signal errors at top/bottom
979;;; of buffer at first key-press (instead moves to top/bottom 986;;; of buffer at first key-press (instead moves to top/bottom
@@ -1062,8 +1069,15 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1062 ;; If rectangle is active, expand rectangle in specified direction and ignore the movement. 1069 ;; If rectangle is active, expand rectangle in specified direction and ignore the movement.
1063 (if movement 1070 (if movement
1064 (cond 1071 (cond
1065 ((memq 'shift (event-modifiers (aref (this-single-command-raw-keys) 0))) 1072 ((memq 'shift (event-modifiers
1066 (unless mark-active 1073 (aref (if window-system
1074 (this-single-command-raw-keys)
1075 (this-single-command-keys)) 0)))
1076 (if mark-active
1077 (if (and (memq this-command cua--preserve-mark-commands)
1078 (not inhibit-mark-movement))
1079 (setq cua--undo-push-mark t
1080 inhibit-mark-movement t))
1067 (push-mark-command nil t)) 1081 (push-mark-command nil t))
1068 (setq cua--last-region-shifted t) 1082 (setq cua--last-region-shifted t)
1069 (setq cua--explicit-region-start nil)) 1083 (setq cua--explicit-region-start nil))
@@ -1110,6 +1124,9 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1110(defun cua--post-command-handler () 1124(defun cua--post-command-handler ()
1111 (condition-case nil 1125 (condition-case nil
1112 (progn 1126 (progn
1127 (when cua--undo-push-mark
1128 (setq cua--undo-push-mark nil
1129 inhibit-mark-movement nil))
1113 (when cua--global-mark-active 1130 (when cua--global-mark-active
1114 (cua--global-mark-post-command)) 1131 (cua--global-mark-post-command))
1115 (when (fboundp 'cua--rectangle-post-command) 1132 (when (fboundp 'cua--rectangle-post-command)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 238d0c4fdf7..3592a6ac779 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -693,7 +693,7 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
693 ;; If the keywords were compiled before, compile them again. 693 ;; If the keywords were compiled before, compile them again.
694 (if was-compiled 694 (if was-compiled
695 (set (make-local-variable 'font-lock-keywords) 695 (set (make-local-variable 'font-lock-keywords)
696 (font-lock-compile-keywords keywords t))))))) 696 (font-lock-compile-keywords font-lock-keywords t)))))))
697 697
698(defun font-lock-update-removed-keyword-alist (mode keywords append) 698(defun font-lock-update-removed-keyword-alist (mode keywords append)
699 ;; Update `font-lock-removed-keywords-alist' when adding new 699 ;; Update `font-lock-removed-keywords-alist' when adding new
@@ -801,7 +801,7 @@ subtle problems due to details of the implementation."
801 ;; If the keywords were compiled before, compile them again. 801 ;; If the keywords were compiled before, compile them again.
802 (if was-compiled 802 (if was-compiled
803 (set (make-local-variable 'font-lock-keywords) 803 (set (make-local-variable 'font-lock-keywords)
804 (font-lock-compile-keywords keywords t))))))) 804 (font-lock-compile-keywords font-lock-keywords t)))))))
805 805
806;;; Font Lock Support mode. 806;;; Font Lock Support mode.
807 807
@@ -1944,12 +1944,12 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1944 '("when" "unless" "case" "ecase" "typecase" "etypecase" 1944 '("when" "unless" "case" "ecase" "typecase" "etypecase"
1945 "ccase" "ctypecase" "handler-case" "handler-bind" 1945 "ccase" "ctypecase" "handler-case" "handler-bind"
1946 "restart-bind" "restart-case" "in-package" 1946 "restart-bind" "restart-case" "in-package"
1947 "cerror" "break" "ignore-errors" 1947 "break" "ignore-errors"
1948 "loop" "do" "do*" "dotimes" "dolist" "the" "locally" 1948 "loop" "do" "do*" "dotimes" "dolist" "the" "locally"
1949 "proclaim" "declaim" "declare" "symbol-macrolet" 1949 "proclaim" "declaim" "declare" "symbol-macrolet"
1950 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let" 1950 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
1951 "destructuring-bind" "macrolet" "tagbody" "block" 1951 "destructuring-bind" "macrolet" "tagbody" "block" "go"
1952 "multiple-value-bind" 1952 "multiple-value-bind" "multiple-value-prog1"
1953 "return" "return-from" 1953 "return" "return-from"
1954 "with-accessors" "with-compilation-unit" 1954 "with-accessors" "with-compilation-unit"
1955 "with-condition-restarts" "with-hash-table-iterator" 1955 "with-condition-restarts" "with-hash-table-iterator"
@@ -1967,7 +1967,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1967 '(2 font-lock-constant-face nil t)) 1967 '(2 font-lock-constant-face nil t))
1968 ;; 1968 ;;
1969 ;; Erroneous structures. 1969 ;; Erroneous structures.
1970 '("(\\(abort\\|assert\\|error\\|signal\\)\\>" 1 font-lock-warning-face) 1970 '("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
1971 ;; 1971 ;;
1972 ;; Words inside \\[] tend to be for `substitute-command-keys'. 1972 ;; Words inside \\[] tend to be for `substitute-command-keys'.
1973 '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend) 1973 '("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend)
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index 4644d36ad25..b5ec6f02260 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -87,8 +87,11 @@ If nil, no blank line will be inserted."
87 87
88;;; Interface variables that probably shouldn't be changed 88;;; Interface variables that probably shouldn't be changed
89 89
90(defconst footnote-section-tag "Footnotes: " 90(defcustom footnote-section-tag "Footnotes: "
91 "*Tag inserted at beginning of footnote section.") 91 "*Tag inserted at beginning of footnote section."
92 :version "21.4"
93 :type 'string
94 :group 'footnote)
92 95
93(defcustom footnote-section-tag-regexp "Footnotes\\(\\[.\\]\\)?: " 96(defcustom footnote-section-tag-regexp "Footnotes\\(\\[.\\]\\)?: "
94 "*Regexp which indicates the start of a footnote section. 97 "*Regexp which indicates the start of a footnote section.
diff --git a/lisp/mh-e/mh-loaddefs.el b/lisp/mh-e/mh-loaddefs.el
index 9b2423dcda9..a5578760845 100644
--- a/lisp/mh-e/mh-loaddefs.el
+++ b/lisp/mh-e/mh-loaddefs.el
@@ -180,7 +180,7 @@ are removed." t nil)
180;;;*** 180;;;***
181 181
182;;;### (autoloads (mh-goto-cur-msg mh-update-sequences mh-folder-line-matches-show-buffer-p) 182;;;### (autoloads (mh-goto-cur-msg mh-update-sequences mh-folder-line-matches-show-buffer-p)
183;;;;;; "mh-e" "mh-e.el" (16627 18152)) 183;;;;;; "mh-e" "mh-e.el" (16627 22341))
184;;; Generated autoloads from mh-e.el 184;;; Generated autoloads from mh-e.el
185 185
186(autoload (quote mh-folder-line-matches-show-buffer-p) "mh-e" "\ 186(autoload (quote mh-folder-line-matches-show-buffer-p) "mh-e" "\
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index cca01d169b6..6a888d9d75d 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1012,7 +1012,7 @@ Domain names in USER and port numbers in HOST are acknowledged."
1012 (when real-user 1012 (when real-user
1013 (let ((pw-prompt "Password:")) 1013 (let ((pw-prompt "Password:"))
1014 (tramp-message 9 "Sending password") 1014 (tramp-message 9 "Sending password")
1015 (tramp-enter-password p pw-prompt))) 1015 (tramp-enter-password p pw-prompt user host)))
1016 1016
1017 (unless (tramp-smb-wait-for-output user host) 1017 (unless (tramp-smb-wait-for-output user host)
1018 (tramp-clear-passwd user host) 1018 (tramp-clear-passwd user host)
diff --git a/lisp/net/tramp-vc.el b/lisp/net/tramp-vc.el
index 839a8702dd9..e720deb8f07 100644
--- a/lisp/net/tramp-vc.el
+++ b/lisp/net/tramp-vc.el
@@ -77,7 +77,7 @@
77 "Like `vc-do-command' but invoked for tramp files. 77 "Like `vc-do-command' but invoked for tramp files.
78See `vc-do-command' for more information." 78See `vc-do-command' for more information."
79 (save-match-data 79 (save-match-data
80 (and file (setq file (tramp-handle-expand-file-name file))) 80 (and file (setq file (expand-file-name file)))
81 (if (not buffer) (setq buffer "*vc*")) 81 (if (not buffer) (setq buffer "*vc*"))
82 (if vc-command-messages 82 (if vc-command-messages
83 (message "Running `%s' on `%s'..." command file)) 83 (message "Running `%s' on `%s'..." command file))
@@ -85,7 +85,7 @@ See `vc-do-command' for more information."
85 (squeezed nil) 85 (squeezed nil)
86 (olddir default-directory) 86 (olddir default-directory)
87 vc-file status) 87 vc-file status)
88 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) 88 (let* ((v (tramp-dissect-file-name (expand-file-name file)))
89 (multi-method (tramp-file-name-multi-method v)) 89 (multi-method (tramp-file-name-multi-method v))
90 (method (tramp-file-name-method v)) 90 (method (tramp-file-name-method v))
91 (user (tramp-file-name-user v)) 91 (user (tramp-file-name-user v))
@@ -130,7 +130,7 @@ See `vc-do-command' for more information."
130 (save-excursion 130 (save-excursion
131 (save-window-excursion 131 (save-window-excursion
132 ;; Actually execute remote command 132 ;; Actually execute remote command
133 (tramp-handle-shell-command 133 (shell-command
134 (mapconcat 'tramp-shell-quote-argument 134 (mapconcat 'tramp-shell-quote-argument
135 (cons command squeezed) " ") t) 135 (cons command squeezed) " ") t)
136 ;;(tramp-wait-for-output) 136 ;;(tramp-wait-for-output)
@@ -190,7 +190,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
190 (let ((w32-quote-process-args t)) 190 (let ((w32-quote-process-args t))
191 (when (eq okstatus 'async) 191 (when (eq okstatus 'async)
192 (message "Tramp doesn't do async commands, running synchronously.")) 192 (message "Tramp doesn't do async commands, running synchronously."))
193 (setq status (tramp-handle-shell-command 193 (setq status (shell-command
194 (mapconcat 'tramp-shell-quote-argument 194 (mapconcat 'tramp-shell-quote-argument
195 (cons command squeezed) " ") t)) 195 (cons command squeezed) " ") t))
196 (when (or (not (integerp status)) 196 (when (or (not (integerp status))
@@ -257,7 +257,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
257 ;; Don't switch to the *vc-info* buffer before running the 257 ;; Don't switch to the *vc-info* buffer before running the
258 ;; command, because that would change its default directory 258 ;; command, because that would change its default directory
259 (save-match-data 259 (save-match-data
260 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) 260 (let* ((v (tramp-dissect-file-name (expand-file-name file)))
261 (multi-method (tramp-file-name-multi-method v)) 261 (multi-method (tramp-file-name-multi-method v))
262 (method (tramp-file-name-method v)) 262 (method (tramp-file-name-method v))
263 (user (tramp-file-name-user v)) 263 (user (tramp-file-name-user v))
@@ -284,7 +284,7 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
284 (save-excursion 284 (save-excursion
285 (save-window-excursion 285 (save-window-excursion
286 ;; Actually execute remote command 286 ;; Actually execute remote command
287 (tramp-handle-shell-command 287 (shell-command
288 (mapconcat 'tramp-shell-quote-argument 288 (mapconcat 'tramp-shell-quote-argument
289 (append (list command) args (list localname)) " ") 289 (append (list command) args (list localname)) " ")
290 (get-buffer-create"*vc-info*")) 290 (get-buffer-create"*vc-info*"))
@@ -414,7 +414,7 @@ filename we are thinking about..."
414 (nth 2 (file-attributes file))))) 414 (nth 2 (file-attributes file)))))
415 (if (and uid (/= uid remote-uid)) 415 (if (and uid (/= uid remote-uid))
416 (error "tramp-handle-vc-user-login-name cannot map a uid to a name") 416 (error "tramp-handle-vc-user-login-name cannot map a uid to a name")
417 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) 417 (let* ((v (tramp-dissect-file-name (expand-file-name file)))
418 (u (tramp-file-name-user v))) 418 (u (tramp-file-name-user v)))
419 (cond ((stringp u) u) 419 (cond ((stringp u) u)
420 ((vectorp u) (elt u (1- (length u)))) 420 ((vectorp u) (elt u (1- (length u))))
@@ -445,8 +445,8 @@ filename we are thinking about..."
445(defun tramp-file-owner (filename) 445(defun tramp-file-owner (filename)
446 "Return who owns FILE (user name, as a string)." 446 "Return who owns FILE (user name, as a string)."
447 (let ((v (tramp-dissect-file-name 447 (let ((v (tramp-dissect-file-name
448 (tramp-handle-expand-file-name filename)))) 448 (expand-file-name filename))))
449 (if (not (tramp-handle-file-exists-p filename)) 449 (if (not (file-exists-p filename))
450 nil ; file cannot be opened 450 nil ; file cannot be opened
451 ;; file exists, find out stuff 451 ;; file exists, find out stuff
452 (save-excursion 452 (save-excursion
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0414859c7eb..02b076483c1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -916,8 +916,8 @@ The answer will be provided by `tramp-action-terminal', which see."
916 "Regular expression indicating a process has finished. 916 "Regular expression indicating a process has finished.
917In fact this expression is empty by intention, it will be used only to 917In fact this expression is empty by intention, it will be used only to
918check regularly the status of the associated process. 918check regularly the status of the associated process.
919The answer will be provided by `tramp-action-process-alive' and 919The answer will be provided by `tramp-action-process-alive',
920`tramp-action-out-of-band', which see." 920`tramp-multi-action-process-alive' and`tramp-action-out-of-band', which see."
921 :group 'tramp 921 :group 'tramp
922 :type 'regexp) 922 :type 'regexp)
923 923
@@ -1321,7 +1321,7 @@ See `tramp-actions-before-shell' for more info."
1321 (shell-prompt-pattern tramp-multi-action-succeed) 1321 (shell-prompt-pattern tramp-multi-action-succeed)
1322 (tramp-shell-prompt-pattern tramp-multi-action-succeed) 1322 (tramp-shell-prompt-pattern tramp-multi-action-succeed)
1323 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied) 1323 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)
1324 (tramp-process-alive-regexp tramp-action-process-alive)) 1324 (tramp-process-alive-regexp tramp-multi-action-process-alive))
1325 "List of pattern/action pairs. 1325 "List of pattern/action pairs.
1326This list is used for each hop in multi-hop connections. 1326This list is used for each hop in multi-hop connections.
1327See `tramp-actions-before-shell' for more info." 1327See `tramp-actions-before-shell' for more info."
@@ -2165,7 +2165,7 @@ target of the symlink differ."
2165 (let ((nonnumeric (and id-format (equal id-format 'string))) 2165 (let ((nonnumeric (and id-format (equal id-format 'string)))
2166 result) 2166 result)
2167 (with-parsed-tramp-file-name filename nil 2167 (with-parsed-tramp-file-name filename nil
2168 (when (tramp-handle-file-exists-p filename) 2168 (when (file-exists-p filename)
2169 ;; file exists, find out stuff 2169 ;; file exists, find out stuff
2170 (save-excursion 2170 (save-excursion
2171 (if (tramp-get-remote-perl multi-method method user host) 2171 (if (tramp-get-remote-perl multi-method method user host)
@@ -2331,7 +2331,12 @@ If it doesn't exist, generate a new one."
2331;; This function makes the same assumption as 2331;; This function makes the same assumption as
2332;; `tramp-handle-set-visited-file-modtime'. 2332;; `tramp-handle-set-visited-file-modtime'.
2333(defun tramp-handle-verify-visited-file-modtime (buf) 2333(defun tramp-handle-verify-visited-file-modtime (buf)
2334 "Like `verify-visited-file-modtime' for tramp files." 2334 "Like `verify-visited-file-modtime' for tramp files.
2335At the time `verify-visited-file-modtime' calls this function, we
2336already know that the buffer is visiting a file and that
2337`visited-file-modtime' does not return 0. Do not call this
2338function directly, unless those two cases are already taken care
2339of."
2335 (with-current-buffer buf 2340 (with-current-buffer buf
2336 (let ((f (buffer-file-name))) 2341 (let ((f (buffer-file-name)))
2337 (with-parsed-tramp-file-name f nil 2342 (with-parsed-tramp-file-name f nil
@@ -2343,7 +2348,14 @@ If it doesn't exist, generate a new one."
2343 ;; (HIGH . LOW)? 2348 ;; (HIGH . LOW)?
2344 (let ((mt (visited-file-modtime))) 2349 (let ((mt (visited-file-modtime)))
2345 (< (abs (tramp-time-diff 2350 (< (abs (tramp-time-diff
2346 modtime (list (car mt) (cdr mt)))) 2))) 2351 modtime
2352 ;; For compatibility, deal with both the old
2353 ;; (HIGH . LOW) and the new (HIGH LOW)
2354 ;; return values of `visited-file-modtime'.
2355 (if (atom (cdr mt))
2356 (list (car mt) (cdr mt))
2357 mt)))
2358 2)))
2347 (attr 2359 (attr
2348 (save-excursion 2360 (save-excursion
2349 (tramp-send-command 2361 (tramp-send-command
@@ -2502,19 +2514,19 @@ if the remote host can't provide the modtime."
2502(defun tramp-handle-file-writable-p (filename) 2514(defun tramp-handle-file-writable-p (filename)
2503 "Like `file-writable-p' for tramp files." 2515 "Like `file-writable-p' for tramp files."
2504 (with-parsed-tramp-file-name filename nil 2516 (with-parsed-tramp-file-name filename nil
2505 (if (tramp-handle-file-exists-p filename) 2517 (if (file-exists-p filename)
2506 ;; Existing files must be writable. 2518 ;; Existing files must be writable.
2507 (zerop (tramp-run-test "-w" filename)) 2519 (zerop (tramp-run-test "-w" filename))
2508 ;; If file doesn't exist, check if directory is writable. 2520 ;; If file doesn't exist, check if directory is writable.
2509 (and (zerop (tramp-run-test 2521 (and (zerop (tramp-run-test
2510 "-d" (tramp-handle-file-name-directory filename))) 2522 "-d" (file-name-directory filename)))
2511 (zerop (tramp-run-test 2523 (zerop (tramp-run-test
2512 "-w" (tramp-handle-file-name-directory filename))))))) 2524 "-w" (file-name-directory filename)))))))
2513 2525
2514(defun tramp-handle-file-ownership-preserved-p (filename) 2526(defun tramp-handle-file-ownership-preserved-p (filename)
2515 "Like `file-ownership-preserved-p' for tramp files." 2527 "Like `file-ownership-preserved-p' for tramp files."
2516 (with-parsed-tramp-file-name filename nil 2528 (with-parsed-tramp-file-name filename nil
2517 (or (not (tramp-handle-file-exists-p filename)) 2529 (or (not (file-exists-p filename))
2518 ;; Existing files must be writable. 2530 ;; Existing files must be writable.
2519 (zerop (tramp-run-test "-O" filename))))) 2531 (zerop (tramp-run-test "-O" filename)))))
2520 2532
@@ -3057,7 +3069,7 @@ This is like `dired-recursive-delete-directory' for tramp files."
3057 (with-parsed-tramp-file-name filename nil 3069 (with-parsed-tramp-file-name filename nil
3058 ;; run a shell command 'rm -r <localname>' 3070 ;; run a shell command 'rm -r <localname>'
3059 ;; Code shamelessly stolen for the dired implementation and, um, hacked :) 3071 ;; Code shamelessly stolen for the dired implementation and, um, hacked :)
3060 (or (tramp-handle-file-exists-p filename) 3072 (or (file-exists-p filename)
3061 (signal 3073 (signal
3062 'file-error 3074 'file-error
3063 (list "Removing old file name" "no such directory" filename))) 3075 (list "Removing old file name" "no such directory" filename)))
@@ -3068,7 +3080,7 @@ This is like `dired-recursive-delete-directory' for tramp files."
3068 ;; This might take a while, allow it plenty of time. 3080 ;; This might take a while, allow it plenty of time.
3069 (tramp-wait-for-output 120) 3081 (tramp-wait-for-output 120)
3070 ;; Make sure that it worked... 3082 ;; Make sure that it worked...
3071 (and (tramp-handle-file-exists-p filename) 3083 (and (file-exists-p filename)
3072 (error "Failed to recusively delete %s" filename)))) 3084 (error "Failed to recusively delete %s" filename))))
3073 3085
3074(defun tramp-handle-dired-call-process (program discard &rest arguments) 3086(defun tramp-handle-dired-call-process (program discard &rest arguments)
@@ -3600,45 +3612,47 @@ This will break if COMMAND prints a newline, followed by the value of
3600 3612
3601(defun tramp-handle-find-backup-file-name (filename) 3613(defun tramp-handle-find-backup-file-name (filename)
3602 "Like `find-backup-file-name' for tramp files." 3614 "Like `find-backup-file-name' for tramp files."
3615 (with-parsed-tramp-file-name filename nil
3616 ;; We set both variables. It doesn't matter whether it is
3617 ;; Emacs or XEmacs
3618 (let ((backup-directory-alist
3619 ;; Emacs case
3620 (when (boundp 'backup-directory-alist)
3621 (if (boundp 'tramp-backup-directory-alist)
3622 (mapcar
3623 '(lambda (x)
3624 (cons
3625 (car x)
3626 (if (and (stringp (cdr x))
3627 (file-name-absolute-p (cdr x))
3628 (not (tramp-file-name-p (cdr x))))
3629 (tramp-make-tramp-file-name
3630 multi-method method user host (cdr x))
3631 (cdr x))))
3632 (symbol-value 'tramp-backup-directory-alist))
3633 (symbol-value 'backup-directory-alist))))
3634
3635 (bkup-backup-directory-info
3636 ;; XEmacs case
3637 (when (boundp 'bkup-backup-directory-info)
3638 (if (boundp 'tramp-bkup-backup-directory-info)
3639 (mapcar
3640 '(lambda (x)
3641 (nconc
3642 (list (car x))
3643 (list
3644 (if (and (stringp (car (cdr x)))
3645 (file-name-absolute-p (car (cdr x)))
3646 (not (tramp-file-name-p (car (cdr x)))))
3647 (tramp-make-tramp-file-name
3648 multi-method method user host (car (cdr x)))
3649 (car (cdr x))))
3650 (cdr (cdr x))))
3651 (symbol-value 'tramp-bkup-backup-directory-info))
3652 (symbol-value 'bkup-backup-directory-info)))))
3653
3654 (tramp-run-real-handler 'find-backup-file-name (list filename)))))
3603 3655
3604 (if (or (and (not (featurep 'xemacs))
3605 (not (boundp 'tramp-backup-directory-alist)))
3606 (and (featurep 'xemacs)
3607 (not (boundp 'tramp-bkup-backup-directory-info))))
3608
3609 ;; No tramp backup directory alist defined, or nil
3610 (tramp-run-real-handler 'find-backup-file-name (list filename))
3611
3612 (with-parsed-tramp-file-name filename nil
3613 (let* ((backup-var
3614 (copy-tree
3615 (if (featurep 'xemacs)
3616 ;; XEmacs case
3617 (symbol-value 'tramp-bkup-backup-directory-info)
3618 ;; Emacs case
3619 (symbol-value 'tramp-backup-directory-alist))))
3620
3621 ;; We set both variables. It doesn't matter whether it is
3622 ;; Emacs or XEmacs
3623 (backup-directory-alist backup-var)
3624 (bkup-backup-directory-info backup-var))
3625
3626 (mapcar
3627 '(lambda (x)
3628 (let ((dir (if (consp (cdr x)) (car (cdr x)) (cdr x))))
3629 (when (and (stringp dir)
3630 (file-name-absolute-p dir)
3631 (not (tramp-file-name-p dir)))
3632 ;; Prepend absolute directory names with tramp prefix
3633 (if (consp (cdr x))
3634 (setcar (cdr x)
3635 (tramp-make-tramp-file-name
3636 multi-method method user host dir))
3637 (setcdr x (tramp-make-tramp-file-name
3638 multi-method method user host dir))))))
3639 backup-var)
3640
3641 (tramp-run-real-handler 'find-backup-file-name (list filename))))))
3642 3656
3643;; CCC grok APPEND, LOCKNAME, CONFIRM 3657;; CCC grok APPEND, LOCKNAME, CONFIRM
3644(defun tramp-handle-write-region 3658(defun tramp-handle-write-region
@@ -3682,6 +3696,9 @@ This will break if COMMAND prints a newline, followed by the value of
3682 ;; use an encoding function, but currently we use it always 3696 ;; use an encoding function, but currently we use it always
3683 ;; because this makes the logic simpler. 3697 ;; because this makes the logic simpler.
3684 (setq tmpfil (tramp-make-temp-file)) 3698 (setq tmpfil (tramp-make-temp-file))
3699 ;; Set current buffer. If connection wasn't open, `file-modes' has
3700 ;; changed it accidently.
3701 (set-buffer curbuf)
3685 ;; We say `no-message' here because we don't want the visited file 3702 ;; We say `no-message' here because we don't want the visited file
3686 ;; modtime data to be clobbered from the temp file. We call 3703 ;; modtime data to be clobbered from the temp file. We call
3687 ;; `set-visited-file-modtime' ourselves later on. 3704 ;; `set-visited-file-modtime' ourselves later on.
@@ -3965,14 +3982,50 @@ Falls back to normal file name handler if no tramp file name handler exists."
3965 (foreign (apply foreign operation args)) 3982 (foreign (apply foreign operation args))
3966 (t (tramp-run-real-handler operation args)))))) 3983 (t (tramp-run-real-handler operation args))))))
3967 3984
3985
3986;; In Emacs, there is some concurrency due to timers. If a timer
3987;; interrupts Tramp and wishes to use the same connection buffer as
3988;; the "main" Emacs, then garbage might occur in the connection
3989;; buffer. Therefore, we need to make sure that a timer does not use
3990;; the same connection buffer as the "main" Emacs. We implement a
3991;; cheap global lock, instead of locking each connection buffer
3992;; separately. The global lock is based on two variables,
3993;; `tramp-locked' and `tramp-locker'. `tramp-locked' is set to true
3994;; (with setq) to indicate a lock. But Tramp also calls itself during
3995;; processing of a single file operation, so we need to allow
3996;; recursive calls. That's where the `tramp-locker' variable comes in
3997;; -- it is let-bound to t during the execution of the current
3998;; handler. So if `tramp-locked' is t and `tramp-locker' is also t,
3999;; then we should just proceed because we have been called
4000;; recursively. But if `tramp-locker' is nil, then we are a timer
4001;; interrupting the "main" Emacs, and then we signal an error.
4002
4003(defvar tramp-locked nil
4004 "If non-nil, then Tramp is currently busy.
4005Together with `tramp-locker', this implements a locking mechanism
4006preventing reentrant calls of Tramp.")
4007
4008(defvar tramp-locker nil
4009 "If non-nil, then a caller has locked Tramp.
4010Together with `tramp-locked', this implements a locking mechanism
4011preventing reentrant calls of Tramp.")
4012
3968(defun tramp-sh-file-name-handler (operation &rest args) 4013(defun tramp-sh-file-name-handler (operation &rest args)
3969 "Invoke remote-shell Tramp file name handler. 4014 "Invoke remote-shell Tramp file name handler.
3970Fall back to normal file name handler if no Tramp handler exists." 4015Fall back to normal file name handler if no Tramp handler exists."
3971 (save-match-data 4016 (when (and tramp-locked (not tramp-locker))
3972 (let ((fn (assoc operation tramp-file-name-handler-alist))) 4017 (signal 'file-error "Forbidden reentrant call of Tramp"))
3973 (if fn 4018 (let ((tl tramp-locked))
3974 (apply (cdr fn) args) 4019 (unwind-protect
3975 (tramp-run-real-handler operation args))))) 4020 (progn
4021 (setq tramp-locked t)
4022 (let ((tramp-locker t))
4023 (save-match-data
4024 (let ((fn (assoc operation tramp-file-name-handler-alist)))
4025 (if fn
4026 (apply (cdr fn) args)
4027 (tramp-run-real-handler operation args))))))
4028 (setq tramp-locked tl))))
3976 4029
3977;;;###autoload 4030;;;###autoload
3978(defun tramp-completion-file-name-handler (operation &rest args) 4031(defun tramp-completion-file-name-handler (operation &rest args)
@@ -4055,7 +4108,7 @@ necessary anymore."
4055 (tramp-make-tramp-file-name multi-method method 4108 (tramp-make-tramp-file-name multi-method method
4056 user host x))) 4109 user host x)))
4057 (read (current-buffer)))))) 4110 (read (current-buffer))))))
4058 (list (tramp-handle-expand-file-name name)))))) 4111 (list (expand-file-name name))))))
4059 4112
4060;; Check for complete.el and override PC-expand-many-files if appropriate. 4113;; Check for complete.el and override PC-expand-many-files if appropriate.
4061(eval-and-compile 4114(eval-and-compile
@@ -4066,7 +4119,7 @@ necessary anymore."
4066 (symbol-function 'PC-expand-many-files)) 4119 (symbol-function 'PC-expand-many-files))
4067 (defun PC-expand-many-files (name) 4120 (defun PC-expand-many-files (name)
4068 (if (tramp-tramp-file-p name) 4121 (if (tramp-tramp-file-p name)
4069 (tramp-handle-expand-many-files name) 4122 (expand-many-files name)
4070 (tramp-save-PC-expand-many-files name)))) 4123 (tramp-save-PC-expand-many-files name))))
4071 4124
4072;; Why isn't eval-after-load sufficient? 4125;; Why isn't eval-after-load sufficient?
@@ -4817,17 +4870,17 @@ file exists and nonzero exit status otherwise."
4817 ;; `/usr/bin/test -e' In case `/bin/test' does not exist. 4870 ;; `/usr/bin/test -e' In case `/bin/test' does not exist.
4818 (unless (or 4871 (unless (or
4819 (and (setq tramp-file-exists-command "test -e %s") 4872 (and (setq tramp-file-exists-command "test -e %s")
4820 (tramp-handle-file-exists-p existing) 4873 (file-exists-p existing)
4821 (not (tramp-handle-file-exists-p nonexisting))) 4874 (not (file-exists-p nonexisting)))
4822 (and (setq tramp-file-exists-command "/bin/test -e %s") 4875 (and (setq tramp-file-exists-command "/bin/test -e %s")
4823 (tramp-handle-file-exists-p existing) 4876 (file-exists-p existing)
4824 (not (tramp-handle-file-exists-p nonexisting))) 4877 (not (file-exists-p nonexisting)))
4825 (and (setq tramp-file-exists-command "/usr/bin/test -e %s") 4878 (and (setq tramp-file-exists-command "/usr/bin/test -e %s")
4826 (tramp-handle-file-exists-p existing) 4879 (file-exists-p existing)
4827 (not (tramp-handle-file-exists-p nonexisting))) 4880 (not (file-exists-p nonexisting)))
4828 (and (setq tramp-file-exists-command "ls -d %s") 4881 (and (setq tramp-file-exists-command "ls -d %s")
4829 (tramp-handle-file-exists-p existing) 4882 (file-exists-p existing)
4830 (not (tramp-handle-file-exists-p nonexisting)))) 4883 (not (file-exists-p nonexisting))))
4831 (error "Couldn't find command to check if file exists.")))) 4884 (error "Couldn't find command to check if file exists."))))
4832 4885
4833 4886
@@ -4889,9 +4942,8 @@ file exists and nonzero exit status otherwise."
4889METHOD, USER and HOST specify the connection, CMD (the absolute file name of) 4942METHOD, USER and HOST specify the connection, CMD (the absolute file name of)
4890the `ls' executable. Returns t if CMD supports the `-n' option, nil 4943the `ls' executable. Returns t if CMD supports the `-n' option, nil
4891otherwise." 4944otherwise."
4892 (tramp-message 9 "Checking remote `%s' command for `-n' option" 4945 (tramp-message 9 "Checking remote `%s' command for `-n' option" cmd)
4893 cmd) 4946 (when (file-executable-p
4894 (when (tramp-handle-file-executable-p
4895 (tramp-make-tramp-file-name multi-method method user host cmd)) 4947 (tramp-make-tramp-file-name multi-method method user host cmd))
4896 (let ((result nil)) 4948 (let ((result nil))
4897 (tramp-message 7 "Testing remote command `%s' for -n..." cmd) 4949 (tramp-message 7 "Testing remote command `%s' for -n..." cmd)
@@ -4949,7 +5001,7 @@ Returns nil if none was found, else the command is returned."
4949 "Query the user for a password." 5001 "Query the user for a password."
4950 (let ((pw-prompt (match-string 0))) 5002 (let ((pw-prompt (match-string 0)))
4951 (tramp-message 9 "Sending password") 5003 (tramp-message 9 "Sending password")
4952 (tramp-enter-password p pw-prompt))) 5004 (tramp-enter-password p pw-prompt user host)))
4953 5005
4954(defun tramp-action-succeed (p multi-method method user host) 5006(defun tramp-action-succeed (p multi-method method user host)
4955 "Signal success in finding shell prompt." 5007 "Signal success in finding shell prompt."
@@ -5027,7 +5079,7 @@ The terminal type can be configured with `tramp-terminal-type'."
5027(defun tramp-multi-action-password (p method user host) 5079(defun tramp-multi-action-password (p method user host)
5028 "Query the user for a password." 5080 "Query the user for a password."
5029 (tramp-message 9 "Sending password") 5081 (tramp-message 9 "Sending password")
5030 (tramp-enter-password p (match-string 0))) 5082 (tramp-enter-password p (match-string 0) user host))
5031 5083
5032(defun tramp-multi-action-succeed (p method user host) 5084(defun tramp-multi-action-succeed (p method user host)
5033 "Signal success in finding shell prompt." 5085 "Signal success in finding shell prompt."
@@ -5042,6 +5094,11 @@ The terminal type can be configured with `tramp-terminal-type'."
5042 (erase-buffer) 5094 (erase-buffer)
5043 (throw 'tramp-action 'permission-denied)) 5095 (throw 'tramp-action 'permission-denied))
5044 5096
5097(defun tramp-multi-action-process-alive (p method user host)
5098 "Check whether a process has finished."
5099 (unless (memq (process-status p) '(run open))
5100 (throw 'tramp-action 'process-died)))
5101
5045;; Functions for processing the actions. 5102;; Functions for processing the actions.
5046 5103
5047(defun tramp-process-one-action (p multi-method method user host actions) 5104(defun tramp-process-one-action (p multi-method method user host actions)
@@ -5239,12 +5296,13 @@ arguments, and xx will be used as the host name to connect to.
5239 (login-args (tramp-get-method-parameter 5296 (login-args (tramp-get-method-parameter
5240 multi-method 5297 multi-method
5241 (tramp-find-method multi-method method user host) 5298 (tramp-find-method multi-method method user host)
5242 user host 'tramp-login-args))) 5299 user host 'tramp-login-args))
5300 (real-host host))
5243 ;; The following should be changed. We need a more general 5301 ;; The following should be changed. We need a more general
5244 ;; mechanism to parse extra host args. 5302 ;; mechanism to parse extra host args.
5245 (when (string-match "\\([^#]*\\)#\\(.*\\)" host) 5303 (when (string-match "\\([^#]*\\)#\\(.*\\)" host)
5246 (setq login-args (cons "-p" (cons (match-string 2 host) login-args))) 5304 (setq login-args (cons "-p" (cons (match-string 2 host) login-args)))
5247 (setq host (match-string 1 host))) 5305 (setq real-host (match-string 1 host)))
5248 (setenv "TERM" tramp-terminal-type) 5306 (setenv "TERM" tramp-terminal-type)
5249 (let* ((default-directory (tramp-temporary-file-directory)) 5307 (let* ((default-directory (tramp-temporary-file-directory))
5250 ;; If we omit the conditional, we would use 5308 ;; If we omit the conditional, we would use
@@ -5255,9 +5313,9 @@ arguments, and xx will be used as the host name to connect to.
5255 tramp-dos-coding-system)) 5313 tramp-dos-coding-system))
5256 (p (if (and user (not (string= user ""))) 5314 (p (if (and user (not (string= user "")))
5257 (apply #'start-process bufnam buf login-program 5315 (apply #'start-process bufnam buf login-program
5258 host "-l" user login-args) 5316 real-host "-l" user login-args)
5259 (apply #'start-process bufnam buf login-program 5317 (apply #'start-process bufnam buf login-program
5260 host login-args))) 5318 real-host login-args)))
5261 (found nil)) 5319 (found nil))
5262 (tramp-set-process-query-on-exit-flag p nil) 5320 (tramp-set-process-query-on-exit-flag p nil)
5263 5321
@@ -5540,10 +5598,10 @@ seconds. If not, it produces an error message with the given ERROR-ARGS."
5540 (pop-to-buffer (buffer-name)) 5598 (pop-to-buffer (buffer-name))
5541 (apply 'error error-args))) 5599 (apply 'error error-args)))
5542 5600
5543(defun tramp-enter-password (p prompt) 5601(defun tramp-enter-password (p prompt user host)
5544 "Prompt for a password and send it to the remote end. 5602 "Prompt for a password and send it to the remote end.
5545Uses PROMPT as a prompt and sends the password to process P." 5603Uses PROMPT as a prompt and sends the password to process P."
5546 (let ((pw (tramp-read-passwd prompt))) 5604 (let ((pw (tramp-read-passwd user host prompt)))
5547 (erase-buffer) 5605 (erase-buffer)
5548 (process-send-string 5606 (process-send-string
5549 p (concat pw 5607 p (concat pw
@@ -6710,16 +6768,11 @@ this is the function `temp-directory'."
6710 "`temp-directory' is defined -- using /tmp.")) 6768 "`temp-directory' is defined -- using /tmp."))
6711 (file-name-as-directory "/tmp")))) 6769 (file-name-as-directory "/tmp"))))
6712 6770
6713(defun tramp-read-passwd (prompt) 6771(defun tramp-read-passwd (user host prompt)
6714 "Read a password from user (compat function). 6772 "Read a password from user (compat function).
6715Invokes `password-read' if available, `read-passwd' else." 6773Invokes `password-read' if available, `read-passwd' else."
6716 (if (functionp 'password-read) 6774 (if (functionp 'password-read)
6717 (let* ((user (or tramp-current-user (user-login-name))) 6775 (let* ((key (concat (or user (user-login-name)) "@" host))
6718 (host (or tramp-current-host (system-name)))
6719 (key (if (and (stringp user) (stringp host))
6720 (concat user "@" host)
6721 (concat "[" (mapconcat 'identity user "/") "]@["
6722 (mapconcat 'identity host "/") "]")))
6723 (password (apply #'password-read (list prompt key)))) 6776 (password (apply #'password-read (list prompt key))))
6724 (apply #'password-cache-add (list key password)) 6777 (apply #'password-cache-add (list key password))
6725 password) 6778 password)
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index a871380d06f..5b678f26171 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -414,7 +414,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
414(defun grep (command-args &optional highlight-regexp) 414(defun grep (command-args &optional highlight-regexp)
415 "Run grep, with user-specified args, and collect output in a buffer. 415 "Run grep, with user-specified args, and collect output in a buffer.
416While grep runs asynchronously, you can use \\[next-error] (M-x next-error), 416While grep runs asynchronously, you can use \\[next-error] (M-x next-error),
417or \\<grep-minor-mode-map>\\[compile-goto-error] in the grep \ 417or \\<grep-mode-map>\\[compile-goto-error] in the grep \
418output buffer, to go to the lines 418output buffer, to go to the lines
419where grep found matches. 419where grep found matches.
420 420
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index fef159d850f..87df0769314 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -99,7 +99,33 @@ Zero means compute the Imenu menu regardless of size."
99 :group 'which-func 99 :group 'which-func
100 :type 'integer) 100 :type 'integer)
101 101
102(defcustom which-func-format '("[" which-func-current "]") 102(defvar which-func-keymap
103 (let ((map (make-sparse-keymap)))
104 (define-key map [mode-line mouse-1] 'beginning-of-defun)
105 (define-key map [mode-line mouse-2]
106 (lambda ()
107 (interactive)
108 (if (eq (point-min) 1)
109 (narrow-to-defun)
110 (widen))))
111 (define-key map [mode-line mouse-3] 'end-of-defun)
112 map)
113 "Keymap to display on mode line which-func.")
114
115(defface which-func-face
116 '((t (:inherit font-lock-function-name-face)))
117 "Face used to highlight mode line function names.
118Defaults to `font-lock-function-name-face' if font-lock is loaded."
119 :group 'which-func)
120
121(defcustom which-func-format
122 `("["
123 (:propertize which-func-current
124 local-map ,which-func-keymap
125 face which-func-face
126 ;;mouse-face highlight ; currently not evaluated :-(
127 help-echo "mouse-1: go to beginning, mouse-2: toggle rest visibility, mouse-3: go to end")
128 "]")
103 "Format for displaying the function in the mode line." 129 "Format for displaying the function in the mode line."
104 :group 'which-func 130 :group 'which-func
105 :type 'sexp) 131 :type 'sexp)
diff --git a/lisp/replace.el b/lisp/replace.el
index 60c28d6c48a..f81c6f53914 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -786,7 +786,8 @@ If the value is nil, don't highlight the buffer names specially."
786 nil 786 nil
787 nil 787 nil
788 nil 788 nil
789 'regexp-history))) 789 'regexp-history
790 default)))
790 (if (equal input "") 791 (if (equal input "")
791 default 792 default
792 input)) 793 input))
diff --git a/lisp/simple.el b/lisp/simple.el
index 74e2d6d82b7..bf57c41b1c1 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -562,9 +562,13 @@ If BACKWARD-ONLY is non-nil, only delete spaces before point."
562 (skip-chars-forward " \t") 562 (skip-chars-forward " \t")
563 (constrain-to-field nil orig-pos t))))) 563 (constrain-to-field nil orig-pos t)))))
564 564
565(defvar inhibit-mark-movement nil
566 "If non-nil, \\[beginning-of-buffer] and \\[end-of-buffer] does not set the mark.")
567
565(defun beginning-of-buffer (&optional arg) 568(defun beginning-of-buffer (&optional arg)
566 "Move point to the beginning of the buffer; leave mark at previous position. 569 "Move point to the beginning of the buffer; leave mark at previous position.
567With arg N, put point N/10 of the way from the beginning. 570With \\[universal-argument] prefix, do not set mark at previous position.
571With numeric arg N, put point N/10 of the way from the beginning.
568 572
569If the buffer is narrowed, this command uses the beginning and size 573If the buffer is narrowed, this command uses the beginning and size
570of the accessible part of the buffer. 574of the accessible part of the buffer.
@@ -572,9 +576,10 @@ of the accessible part of the buffer.
572Don't use this command in Lisp programs! 576Don't use this command in Lisp programs!
573\(goto-char (point-min)) is faster and avoids clobbering the mark." 577\(goto-char (point-min)) is faster and avoids clobbering the mark."
574 (interactive "P") 578 (interactive "P")
575 (push-mark) 579 (unless (or inhibit-mark-movement (consp arg))
580 (push-mark))
576 (let ((size (- (point-max) (point-min)))) 581 (let ((size (- (point-max) (point-min))))
577 (goto-char (if arg 582 (goto-char (if (and arg (not (consp arg)))
578 (+ (point-min) 583 (+ (point-min)
579 (if (> size 10000) 584 (if (> size 10000)
580 ;; Avoid overflow for large buffer sizes! 585 ;; Avoid overflow for large buffer sizes!
@@ -586,7 +591,8 @@ Don't use this command in Lisp programs!
586 591
587(defun end-of-buffer (&optional arg) 592(defun end-of-buffer (&optional arg)
588 "Move point to the end of the buffer; leave mark at previous position. 593 "Move point to the end of the buffer; leave mark at previous position.
589With arg N, put point N/10 of the way from the end. 594With \\[universal-argument] prefix, do not set mark at previous position.
595With numeric arg N, put point N/10 of the way from the end.
590 596
591If the buffer is narrowed, this command uses the beginning and size 597If the buffer is narrowed, this command uses the beginning and size
592of the accessible part of the buffer. 598of the accessible part of the buffer.
@@ -594,9 +600,10 @@ of the accessible part of the buffer.
594Don't use this command in Lisp programs! 600Don't use this command in Lisp programs!
595\(goto-char (point-max)) is faster and avoids clobbering the mark." 601\(goto-char (point-max)) is faster and avoids clobbering the mark."
596 (interactive "P") 602 (interactive "P")
597 (push-mark) 603 (unless (or inhibit-mark-movement (consp arg))
604 (push-mark))
598 (let ((size (- (point-max) (point-min)))) 605 (let ((size (- (point-max) (point-min))))
599 (goto-char (if arg 606 (goto-char (if (and arg (not (consp arg)))
600 (- (point-max) 607 (- (point-max)
601 (if (> size 10000) 608 (if (> size 10000)
602 ;; Avoid overflow for large buffer sizes! 609 ;; Avoid overflow for large buffer sizes!