aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2013-01-11 00:03:43 +0100
committerJoakim Verona2013-01-11 00:03:43 +0100
commit26f277ba01010776e63623d446f182f5b6f23dd3 (patch)
treeaa2a9a9f31241f687902eafafc1535ea23bd1887 /lisp
parent09708f70bd02e7a2edec79e1bcfd04fb9b7f48d3 (diff)
parenta778dd57d0da9004a72320f8082d4f6220f178e2 (diff)
downloademacs-26f277ba01010776e63623d446f182f5b6f23dd3.tar.gz
emacs-26f277ba01010776e63623d446f182f5b6f23dd3.zip
auto upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog115
-rw-r--r--lisp/autorevert.el101
-rw-r--r--lisp/cus-start.el6
-rw-r--r--lisp/doc-view.el236
-rw-r--r--lisp/emacs-lisp/authors.el16
-rw-r--r--lisp/emacs-lisp/crm.el59
-rw-r--r--lisp/faces.el36
-rw-r--r--lisp/files.el2
-rw-r--r--lisp/image-mode.el5
-rw-r--r--lisp/imenu.el2
-rw-r--r--lisp/man.el79
-rw-r--r--lisp/progmodes/cc-engine.el42
-rw-r--r--lisp/progmodes/which-func.el4
-rw-r--r--lisp/simple.el6
14 files changed, 485 insertions, 224 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3ccb944a2f4..0d4566a91a6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,116 @@
12013-01-10 Michael Albinus <michael.albinus@gmx.de>
2
3 * autorevert.el (auto-revert-notify-enabled): Move up.
4 (auto-revert-use-notify): New defcustom.
5 (auto-revert-mode, global-auto-revert-mode)
6 (auto-revert-notify-add-watch, auto-revert-handler)
7 (auto-revert-buffers): Use `auto-revert-use-notify' instead of
8 `auto-revert-notify-enabled'.
9
102013-01-10 Elias Pipping <pipping@exherbo.org>
11
12 * files.el (auto-mode-alist): Use doc-view for djvu files (bug#13164).
13 * doc-view.el (doc-view-document->bitmap):
14 Use doc-view-single-page-converter-function instead of
15 single-page-converter arg; adjust callers.
16
172013-01-10 Feng Li <fengli@gmail.com> (tiny change)
18
19 * progmodes/which-func.el (which-function): Understand Semantic's use
20 of overlays in imenu--index-alist.
21
222013-01-10 Wolfgang Jenkner <wjenkner@inode.at>
23
24 * man.el: Handle different "man -k" behaviors (bug#13160). Use utf-8.
25 (Man-man-k-use-anchor): New var.
26 (Man-parse-man-k): New function.
27 (Man-completion-table): Use it.
28 (man): Flush the completion cache between uses.
29
302013-01-10 Michael Albinus <michael.albinus@gmx.de>
31
32 * autorevert.el: Add file watch support.
33 (auto-revert-notify-enabled): New defconst.
34 (auto-revert-notify-watch-descriptor-hash-list)
35 (auto-revert-notify-watch-descriptor)
36 (auto-revert-notify-modified-p): New defvars.
37 (auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
38 (auto-revert-notify-handler): New defuns.
39 (auto-revert-mode, global-auto-revert-mode): Remove file watches
40 when mode is disabled.
41 (auto-revert-handler): Check for `auto-revert-notify-modified-p'.
42 (auto-revert-buffers): Add file watches for active buffers.
43
442013-01-10 Dmitry Antipov <dmantipov@yandex.ru>
45
46 * cus-start.el (toplevel): Only allow float values for
47 scroll-up-aggressively and scroll-down-aggressively.
48 Allow any number for line-spacing.
49
502013-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
51
52 * doc-view.el (doc-view-pdfdraw-program): Allow "pdfdraw" name.
53 (doc-view-pdf->png-converter-function): Use mupdf if available.
54 (doc-view-djvu->png-converter-function)
55 (doc-view-ps->png-converter-function): Remove.
56 (doc-view--image-file-pattern): Replace doc-view--image-file-extension.
57 (doc-view-goto-page, doc-view-convert-current-doc, doc-view-display)
58 (doc-view-already-converted-p): Adjust accordingly.
59 (doc-view-mode-p): Simplify.
60 (doc-view-enlarge): Use setq-local.
61 (doc-view-pdf->png-converter-ghostscript)
62 (doc-view-djvu->png-converter-ddjvu)
63 (doc-view-pdf->png-converter-mupdf): Rework to call
64 doc-view-start-process directly.
65 (doc-view-pdf/ps->png): Simplify accordingly.
66 (doc-view-pdf->png-1, doc-view-djvu->png-1): Remove.
67 (doc-view-document->bitmap): Rename from doc-view-document->png.
68 (doc-view-convert-current-doc): Merge pdf and djvu cases.
69 (doc-view-set-slice-from-bounding-box): Fix completion table.
70 (doc-view-mode): Use add-hook for after-revert-hook.
71
722013-01-10 Glenn Morris <rgm@gnu.org>
73
74 * emacs-lisp/authors.el (authors-ignored-files)
75 (authors-valid-file-names, authors-renamed-files-alist):
76 Add some more entries.
77
782013-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
79
80 * image-mode.el (image-mode-winprops): Don't throw away the fallback
81 `t' pseudo-window entry.
82
832013-01-10 Alan Mackenzie <acm@muc.de>
84
85 Fix bugs in the c-parse-state mechanism. Reuse some markers
86 instead of continually generating new ones.
87
88 * progmodes/cc-engine.el (c-state-old-cpp-beg-marker)
89 (c-state-old-cpp-end-marker): New variables.
90 (c-append-lower-brace-pair-to-state-cache): Start a backward
91 search for "}" definitively outside CPP constructs.
92 (c-remove-stale-state-cache): Inform the caller of a need to
93 search back for a brace pair in certain circumstances.
94 (c-state-maybe-marker): New macro.
95 (c-parse-state): Reuse markers when appropriate.
96
972013-01-10 Glenn Morris <rgm@gnu.org>
98
99 * simple.el (execute-extended-command): Doc fix.
100 Bind prefix-arg around read-extended-command, for prompt. (Bug#13395)
101
1022013-01-10 Chong Yidong <cyd@gnu.org>
103
104 * faces.el (read-face-name): Doc fix.
105
1062013-01-10 Roland Winkler <winkler@gnu.org>
107
108 * emacs-lisp/crm.el: Allow any regexp for separators.
109 (crm-default-separator): All spaces around the default comma separator.
110 (crm--completion-command): New macro.
111 (crm-completion-help, crm-complete, crm-complete-word): Use it.
112 (crm-complete-and-exit): Handle non-single-char separators.
113
12013-01-09 Elias Pipping <pipping@lavabit.com> 1142013-01-09 Elias Pipping <pipping@lavabit.com>
2 115
3 * doc-view.el: Add support for DjVu (bug#13164). 116 * doc-view.el: Add support for DjVu (bug#13164).
@@ -5945,7 +6058,7 @@
5945 6058
59462012-08-08 Fabián Ezequiel Gallina <fgallina@cuca> 60592012-08-08 Fabián Ezequiel Gallina <fgallina@cuca>
5947 6060
5948 * progmodes/python.el Fixed defsubst warning. 6061 * progmodes/python.el: Fix defsubst warning.
5949 (python-syntax-context) Rename from python-info-ppss-context. 6062 (python-syntax-context) Rename from python-info-ppss-context.
5950 (python-syntax-context-type): Rename from 6063 (python-syntax-context-type): Rename from
5951 python-info-ppss-context-type. 6064 python-info-ppss-context-type.
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index f491f2427be..4434ed21169 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -48,6 +48,11 @@
48;; Emacs. You should never even notice that this package is active 48;; Emacs. You should never even notice that this package is active
49;; (except that your buffers will be reverted, of course). 49;; (except that your buffers will be reverted, of course).
50;; 50;;
51;; If Emacs is compiled with file watch support, notifications are
52;; used instead of checking the time stamp of the files. You can
53;; disable this by setting the user option `auto-revert-use-notify' to
54;; nil.
55;;
51;; After reverting a file buffer, Auto Revert Mode normally puts point 56;; After reverting a file buffer, Auto Revert Mode normally puts point
52;; at the same position that a regular manual revert would. However, 57;; at the same position that a regular manual revert would. However,
53;; there is one exception to this rule. If point is at the end of the 58;; there is one exception to this rule. If point is at the end of the
@@ -254,6 +259,28 @@ buffers. CPU usage depends on the version control system."
254This variable becomes buffer local when set in any fashion.") 259This variable becomes buffer local when set in any fashion.")
255(make-variable-buffer-local 'global-auto-revert-ignore-buffer) 260(make-variable-buffer-local 'global-auto-revert-ignore-buffer)
256 261
262(defconst auto-revert-notify-enabled
263 (or (featurep 'inotify) (featurep 'w32notify))
264 "Non-nil when Emacs has been compiled with file watch support.")
265
266(defcustom auto-revert-use-notify auto-revert-notify-enabled
267 "If non-nil Auto Revert Mode uses file watch functions.
268This requires Emacs being compiled with file watch support (see
269`auto-revert-notify-enabled'). You should set this variable
270through Custom only."
271 :group 'auto-revert
272 :type 'boolean
273 :set (lambda (variable value)
274 (set-default variable (and auto-revert-notify-enabled value))
275 (if (symbol-value variable)
276 (add-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
277 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
278 (when auto-revert-notify-enabled
279 (dolist (buf (buffer-list))
280 (with-current-buffer buf
281 (auto-revert-notify-rm-watch))))))
282 :version "24.4")
283
257;; Internal variables: 284;; Internal variables:
258 285
259(defvar auto-revert-buffer-list () 286(defvar auto-revert-buffer-list ()
@@ -276,6 +303,20 @@ the list of old buffers.")
276 (set (make-local-variable 'auto-revert-tail-pos) 303 (set (make-local-variable 'auto-revert-tail-pos)
277 (nth 7 (file-attributes buffer-file-name))))) 304 (nth 7 (file-attributes buffer-file-name)))))
278 305
306(defvar auto-revert-notify-watch-descriptor-hash-list
307 (make-hash-table :test 'equal)
308 "A hash table collecting all file watch descriptors.
309Hash key is a watch descriptor, hash value is the corresponding buffer.")
310
311(defvar auto-revert-notify-watch-descriptor nil
312 "The file watch descriptor active for the current buffer.")
313(make-variable-buffer-local 'auto-revert-notify-watch-descriptor)
314
315(defvar auto-revert-notify-modified-p nil
316 "Non-nil when file has been modified on the file system.
317This has been reported by a file watch event.")
318(make-variable-buffer-local 'auto-revert-notify-modified-p)
319
279;; Functions: 320;; Functions:
280 321
281;;;###autoload 322;;;###autoload
@@ -296,6 +337,7 @@ without being changed in the part that is already in the buffer."
296 (if auto-revert-mode 337 (if auto-revert-mode
297 (if (not (memq (current-buffer) auto-revert-buffer-list)) 338 (if (not (memq (current-buffer) auto-revert-buffer-list))
298 (push (current-buffer) auto-revert-buffer-list)) 339 (push (current-buffer) auto-revert-buffer-list))
340 (when auto-revert-use-notify (auto-revert-notify-rm-watch))
299 (setq auto-revert-buffer-list 341 (setq auto-revert-buffer-list
300 (delq (current-buffer) auto-revert-buffer-list))) 342 (delq (current-buffer) auto-revert-buffer-list)))
301 (auto-revert-set-timer) 343 (auto-revert-set-timer)
@@ -399,9 +441,12 @@ It displays the text that `global-auto-revert-mode-text'
399specifies in the mode line." 441specifies in the mode line."
400 :global t :group 'auto-revert :lighter global-auto-revert-mode-text 442 :global t :group 'auto-revert :lighter global-auto-revert-mode-text
401 (auto-revert-set-timer) 443 (auto-revert-set-timer)
402 (when global-auto-revert-mode 444 (if global-auto-revert-mode
403 (auto-revert-buffers))) 445 (auto-revert-buffers)
404 446 (when auto-revert-use-notify
447 (dolist (buf (buffer-list))
448 (with-current-buffer buf
449 (auto-revert-notify-rm-watch))))))
405 450
406(defun auto-revert-set-timer () 451(defun auto-revert-set-timer ()
407 "Restart or cancel the timer used by Auto-Revert Mode. 452 "Restart or cancel the timer used by Auto-Revert Mode.
@@ -418,6 +463,39 @@ will use an up-to-date value of `auto-revert-interval'"
418 auto-revert-interval 463 auto-revert-interval
419 'auto-revert-buffers)))) 464 'auto-revert-buffers))))
420 465
466(defun auto-revert-notify-rm-watch ()
467 "Disable file watch for current buffer's associated file."
468 (when auto-revert-notify-watch-descriptor
469 (funcall (if (fboundp 'inotify-rm-watch) 'inotify-rm-watch 'w32-rm-watch)
470 auto-revert-notify-watch-descriptor)
471 (remhash auto-revert-notify-watch-descriptor
472 auto-revert-notify-watch-descriptor-hash-list))
473 (setq auto-revert-notify-watch-descriptor nil
474 auto-revert-notify-modified-p nil))
475
476(defun auto-revert-notify-add-watch ()
477 "Enable file watch for current buffer's associated file."
478 (when (and buffer-file-name auto-revert-use-notify)
479 (auto-revert-notify-rm-watch)
480 (let ((func (if (fboundp 'inotify-add-watch)
481 'inotify-add-watch 'w32-add-watch))
482 (aspect (if (fboundp 'inotify-add-watch)
483 '(close-write) '(last-write-time))))
484 (setq auto-revert-notify-watch-descriptor
485 (funcall func buffer-file-name aspect 'auto-revert-notify-handler))
486 (puthash auto-revert-notify-watch-descriptor
487 (current-buffer)
488 auto-revert-notify-watch-descriptor-hash-list))))
489
490(defun auto-revert-notify-handler (event)
491 "Handle an event returned from file watch."
492 (when (listp event)
493 (let ((buffer
494 (gethash (car event) auto-revert-notify-watch-descriptor-hash-list)))
495 (when (bufferp buffer)
496 (with-current-buffer buffer
497 (setq auto-revert-notify-modified-p t))))))
498
421(defun auto-revert-active-p () 499(defun auto-revert-active-p ()
422 "Check if auto-revert is active (in current buffer or globally)." 500 "Check if auto-revert is active (in current buffer or globally)."
423 (or auto-revert-mode 501 (or auto-revert-mode
@@ -445,9 +523,12 @@ This is an internal function used by Auto-Revert Mode."
445 (setq size 523 (setq size
446 (nth 7 (file-attributes 524 (nth 7 (file-attributes
447 buffer-file-name)))))) 525 buffer-file-name))))))
448 (and (not (file-remote-p buffer-file-name)) 526 (if auto-revert-use-notify
449 (file-readable-p buffer-file-name) 527 ;; There are file watches.
450 (not (verify-visited-file-modtime buffer))))) 528 auto-revert-notify-modified-p
529 (and (not (file-remote-p buffer-file-name))
530 (file-readable-p buffer-file-name)
531 (not (verify-visited-file-modtime buffer))))))
451 (and (or auto-revert-mode 532 (and (or auto-revert-mode
452 global-auto-revert-non-file-buffers) 533 global-auto-revert-non-file-buffers)
453 revert-buffer-function 534 revert-buffer-function
@@ -456,6 +537,7 @@ This is an internal function used by Auto-Revert Mode."
456 (funcall buffer-stale-function t)))) 537 (funcall buffer-stale-function t))))
457 eob eoblist) 538 eob eoblist)
458 (when revert 539 (when revert
540 (setq auto-revert-notify-modified-p nil)
459 (when (and auto-revert-verbose 541 (when (and auto-revert-verbose
460 (not (eq revert 'fast))) 542 (not (eq revert 'fast)))
461 (message "Reverting buffer `%s'." (buffer-name))) 543 (message "Reverting buffer `%s'." (buffer-name)))
@@ -561,7 +643,12 @@ the timer when no buffers need to be checked."
561 (memq buf auto-revert-buffer-list)) 643 (memq buf auto-revert-buffer-list))
562 (setq auto-revert-buffer-list 644 (setq auto-revert-buffer-list
563 (delq buf auto-revert-buffer-list))) 645 (delq buf auto-revert-buffer-list)))
564 (when (auto-revert-active-p) (auto-revert-handler))) 646 (when (auto-revert-active-p)
647 ;; Enable file watches.
648 (when (and auto-revert-use-notify buffer-file-name
649 (not auto-revert-notify-watch-descriptor)
650 (auto-revert-notify-add-watch)))
651 (auto-revert-handler)))
565 ;; Remove dead buffer from `auto-revert-buffer-list'. 652 ;; Remove dead buffer from `auto-revert-buffer-list'.
566 (setq auto-revert-buffer-list 653 (setq auto-revert-buffer-list
567 (delq buf auto-revert-buffer-list)))) 654 (delq buf auto-revert-buffer-list))))
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 9d2c2750987..b954ed60baa 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -115,12 +115,12 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
115 (const :tag "On the right" (down . right)))) 115 (const :tag "On the right" (down . right))))
116 (other :tag "On left, no arrows" t))) 116 (other :tag "On left, no arrows" t)))
117 (scroll-up-aggressively windows 117 (scroll-up-aggressively windows
118 (choice (const :tag "off" nil) number) 118 (choice (const :tag "off" nil) float)
119 "21.1") 119 "21.1")
120 (scroll-down-aggressively windows 120 (scroll-down-aggressively windows
121 (choice (const :tag "off" nil) number) 121 (choice (const :tag "off" nil) float)
122 "21.1") 122 "21.1")
123 (line-spacing display (choice (const :tag "none" nil) integer) 123 (line-spacing display (choice (const :tag "none" nil) number)
124 "22.1") 124 "22.1")
125 (cursor-in-non-selected-windows 125 (cursor-in-non-selected-windows
126 cursor boolean nil 126 cursor boolean nil
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 0658a11c30a..fa54eef828d 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -158,13 +158,18 @@
158 :type 'file 158 :type 'file
159 :group 'doc-view) 159 :group 'doc-view)
160 160
161(defcustom doc-view-pdfdraw-program "mudraw" 161(defcustom doc-view-pdfdraw-program
162 "Program to convert PDF files to PNG." 162 (cond
163 ((executable-find "pdfdraw") "pdfdraw")
164 (t "mudraw"))
165 "Name of MuPDF's program to convert PDF files to PNG."
163 :type 'file 166 :type 'file
164 :version "24.4") 167 :version "24.4")
165 168
166(defcustom doc-view-pdf->png-converter-function 169(defcustom doc-view-pdf->png-converter-function
167 'doc-view-pdf->png-converter-ghostscript 170 (if (executable-find doc-view-pdfdraw-program)
171 #'doc-view-pdf->png-converter-mupdf
172 #'doc-view-pdf->png-converter-ghostscript)
168 "Function to call to convert a PDF file into a PNG file." 173 "Function to call to convert a PDF file into a PNG file."
169 :type '(radio 174 :type '(radio
170 (function-item doc-view-pdf->png-converter-ghostscript 175 (function-item doc-view-pdf->png-converter-ghostscript
@@ -174,23 +179,6 @@
174 function) 179 function)
175 :version "24.4") 180 :version "24.4")
176 181
177;; FIXME: Get rid of it: there's no choice.
178(defcustom doc-view-djvu->png-converter-function
179 'doc-view-djvu->png-converter-ddjvu
180 "Function to call to convert a DJVU file into a PNG file"
181 :type '(radio (function-item doc-view-djvu->png-converter-ddjvu
182 :doc "Use ddjvu")
183 function))
184
185;; FIXME: Get rid of it: there's no choice.
186(defcustom doc-view-ps->png-converter-function
187 'doc-view-ps->png-converter-ghostscript
188 "Function to call to convert a PS file into a PNG file."
189 :type '(radio (function-item doc-view-ps->png-converter-ghostscript
190 :doc "Use ghostscript")
191 function)
192 :version "24.4")
193
194(defcustom doc-view-ghostscript-options 182(defcustom doc-view-ghostscript-options
195 '("-dSAFER" ;; Avoid security problems when rendering files from untrusted 183 '("-dSAFER" ;; Avoid security problems when rendering files from untrusted
196 ;; sources. 184 ;; sources.
@@ -358,14 +346,13 @@ Can be `dvi', `pdf', or `ps'.")
358May operate on the source document or on some intermediate (typically PDF) 346May operate on the source document or on some intermediate (typically PDF)
359conversion of it.") 347conversion of it.")
360 348
361(defvar doc-view--image-type nil 349(defvar-local doc-view--image-type nil
362 "The type of image in the current buffer. 350 "The type of image in the current buffer.
363Can be `png' or `tiff'.") 351Can be `png' or `tiff'.")
364 352
365(defvar doc-view--image-file-extension nil 353(defvar-local doc-view--image-file-pattern nil
366 ;; FIXME: Replace it with a `format' string, like "page-%d.png". 354 "The `format' pattern of image file names.
367 "The file extension of the image type in the current buffer. 355Typically \"page-%s.png\".")
368Can be `png' or `tif'.")
369 356
370;;;; DocView Keymaps 357;;;; DocView Keymaps
371 358
@@ -506,7 +493,7 @@ Can be `png' or `tif'.")
506 ;; that's not right if the pages are not generated sequentially 493 ;; that's not right if the pages are not generated sequentially
507 ;; or if the page isn't in doc-view-current-files yet. 494 ;; or if the page isn't in doc-view-current-files yet.
508 (let ((file (expand-file-name 495 (let ((file (expand-file-name
509 (format "page-%d.%s" page doc-view--image-file-extension) 496 (format doc-view--image-file-pattern page)
510 (doc-view-current-cache-dir)))) 497 (doc-view-current-cache-dir))))
511 (doc-view-insert-image file :pointer 'arrow) 498 (doc-view-insert-image file :pointer 'arrow)
512 (set-window-hscroll (selected-window) hscroll) 499 (set-window-hscroll (selected-window) hscroll)
@@ -708,8 +695,7 @@ OpenDocument format)."
708 (executable-find doc-view-dvipdf-program)) 695 (executable-find doc-view-dvipdf-program))
709 (and doc-view-dvipdfm-program 696 (and doc-view-dvipdfm-program
710 (executable-find doc-view-dvipdfm-program))))) 697 (executable-find doc-view-dvipdfm-program)))))
711 ((or (eq type 'postscript) (eq type 'ps) (eq type 'eps) 698 ((memq type '(postscript ps eps pdf))
712 (eq type 'pdf))
713 ;; FIXME: allow mupdf here 699 ;; FIXME: allow mupdf here
714 (and doc-view-ghostscript-program 700 (and doc-view-ghostscript-program
715 (executable-find doc-view-ghostscript-program))) 701 (executable-find doc-view-ghostscript-program)))
@@ -735,13 +721,13 @@ OpenDocument format)."
735 ;; ImageMagick supports on-the-fly-rescaling. 721 ;; ImageMagick supports on-the-fly-rescaling.
736 (let ((new (ceiling (* factor doc-view-image-width)))) 722 (let ((new (ceiling (* factor doc-view-image-width))))
737 (unless (equal new doc-view-image-width) 723 (unless (equal new doc-view-image-width)
738 (set (make-local-variable 'doc-view-image-width) new) 724 (setq-local doc-view-image-width new)
739 (doc-view-insert-image 725 (doc-view-insert-image
740 (plist-get (cdr (doc-view-current-image)) :file) 726 (plist-get (cdr (doc-view-current-image)) :file)
741 :width doc-view-image-width))) 727 :width doc-view-image-width)))
742 (let ((new (ceiling (* factor doc-view-resolution)))) 728 (let ((new (ceiling (* factor doc-view-resolution))))
743 (unless (equal new doc-view-resolution) 729 (unless (equal new doc-view-resolution)
744 (set (make-local-variable 'doc-view-resolution) new) 730 (setq-local doc-view-resolution new)
745 (doc-view-reconvert-doc))))) 731 (doc-view-reconvert-doc)))))
746 732
747(defun doc-view-shrink (factor) 733(defun doc-view-shrink (factor)
@@ -878,35 +864,44 @@ Should be invoked when the cached images aren't up-to-date."
878 (list "-o" pdf dvi) 864 (list "-o" pdf dvi)
879 callback))) 865 callback)))
880 866
881(defun doc-view-pdf->png-converter-ghostscript (resolution pdf png &optional page) 867(defun doc-view-pdf->png-converter-ghostscript (pdf png page callback)
882 `((command . ,doc-view-ghostscript-program) 868 (doc-view-start-process
883 (arguments . (,@doc-view-ghostscript-options 869 "pdf/ps->png" doc-view-ghostscript-program
884 ,(format "-r%d" resolution) 870 `(,@doc-view-ghostscript-options
885 ,@(if page `(,(format "-dFirstPage=%d" page))) 871 ,(format "-r%d" (round doc-view-resolution))
886 ,@(if page `(,(format "-dLastPage=%d" page))) 872 ,@(if page `(,(format "-dFirstPage=%d" page)))
887 ,(concat "-sOutputFile=" png) 873 ,@(if page `(,(format "-dLastPage=%d" page)))
888 ,pdf)))) 874 ,(concat "-sOutputFile=" png)
875 ,pdf)
876 callback))
889 877
890(defalias 'doc-view-ps->png-converter-ghostscript 878(defalias 'doc-view-ps->png-converter-ghostscript
891 'doc-view-pdf->png-converter-ghostscript) 879 'doc-view-pdf->png-converter-ghostscript)
892 880
893(defun doc-view-djvu->png-converter-ddjvu (resolution djvu png &optional page) 881(defun doc-view-djvu->tiff-converter-ddjvu (djvu tiff page callback)
894 `((command . "ddjvu") 882 "Convert PAGE of a DJVU file to bitmap(s) asynchronously.
895 (arguments . ("-format=tiff" 883Call CALLBACK with no arguments when done.
896 ;; ddjvu only accepts the range 1-999. 884If PAGE is nil, convert the whole document."
897 ,(format "-scale=%d" resolution) 885 (doc-view-start-process
898 ;; -eachpage was only added after djvulibre-3.5.25.3! 886 "djvu->tiff" "ddjvu"
899 ,@(unless page '("-eachpage")) 887 `("-format=tiff"
900 ,@(if page `(,(format "-page=%d" page))) 888 ;; ddjvu only accepts the range 1-999.
901 ,djvu 889 ,(format "-scale=%d" (round doc-view-resolution))
902 ,png)))) 890 ;; -eachpage was only added after djvulibre-3.5.25.3!
903 891 ,@(unless page '("-eachpage"))
904(defun doc-view-pdf->png-converter-mupdf (resolution pdf png &optional page) 892 ,@(if page `(,(format "-page=%d" page)))
905 `((command . ,doc-view-pdfdraw-program) 893 ,djvu
906 (arguments . (,(concat "-o" png) 894 ,tiff)
907 ,(format "-r%d" resolution) 895 callback))
908 ,pdf 896
909 ,@(if page `(,(format "%d" page))))))) 897(defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
898 (doc-view-start-process
899 "pdf->png" doc-view-pdfdraw-program
900 `(,(concat "-o" png)
901 ,(format "-r%d" (round doc-view-resolution))
902 ,pdf
903 ,@(if page `(,(format "%d" page))))
904 callback))
910 905
911(defun doc-view-odf->pdf (odf callback) 906(defun doc-view-odf->pdf (odf callback)
912 "Convert ODF to PDF asynchronously and call CALLBACK when finished. 907 "Convert ODF to PDF asynchronously and call CALLBACK when finished.
@@ -919,16 +914,12 @@ is named like ODF with the extension turned to pdf."
919(defun doc-view-pdf/ps->png (pdf-ps png) 914(defun doc-view-pdf/ps->png (pdf-ps png)
920 ;; FIXME: Fix name and docstring to account for djvu&tiff. 915 ;; FIXME: Fix name and docstring to account for djvu&tiff.
921 "Convert PDF-PS to PNG asynchronously." 916 "Convert PDF-PS to PNG asynchronously."
922 (let ((invocation 917 (funcall
923 (funcall (pcase doc-view-doc-type 918 (pcase doc-view-doc-type
924 (`pdf doc-view-pdf->png-converter-function) 919 (`pdf doc-view-pdf->png-converter-function)
925 (`djvu doc-view-djvu->png-converter-function) 920 (`djvu #'doc-view-djvu->tiff-converter-ddjvu)
926 (_ doc-view-ps->png-converter-function)) 921 (_ #'doc-view-ps->png-converter-ghostscript))
927 (round doc-view-resolution) pdf-ps png))) 922 pdf-ps png nil
928
929 (doc-view-start-process
930 "pdf/ps->png" (cdr (assoc 'command invocation))
931 (cdr (assoc 'arguments invocation))
932 (let ((resolution doc-view-resolution)) 923 (let ((resolution doc-view-resolution))
933 (lambda () 924 (lambda ()
934 ;; Only create the resolution file when it's all done, so it also 925 ;; Only create the resolution file when it's all done, so it also
@@ -940,7 +931,8 @@ is named like ODF with the extension turned to pdf."
940 (when doc-view-current-timer 931 (when doc-view-current-timer
941 (cancel-timer doc-view-current-timer) 932 (cancel-timer doc-view-current-timer)
942 (setq doc-view-current-timer nil)) 933 (setq doc-view-current-timer nil))
943 (doc-view-display (current-buffer) 'force))))) 934 (doc-view-display (current-buffer) 'force))))
935
944 ;; Update the displayed pages as soon as they're done generating. 936 ;; Update the displayed pages as soon as they're done generating.
945 (when doc-view-conversion-refresh-interval 937 (when doc-view-conversion-refresh-interval
946 (setq doc-view-current-timer 938 (setq doc-view-current-timer
@@ -948,31 +940,10 @@ is named like ODF with the extension turned to pdf."
948 'doc-view-display 940 'doc-view-display
949 (current-buffer))))) 941 (current-buffer)))))
950 942
951(defun doc-view-pdf->png-1 (pdf png page callback)
952 "Convert a PAGE of a PDF file to PNG asynchronously.
953Call CALLBACK with no arguments when done."
954 (let ((invocation (funcall doc-view-pdf->png-converter-function
955 (round doc-view-resolution) pdf png page)))
956 (doc-view-start-process
957 "pdf/ps->png" (cdr (assoc 'command invocation))
958 (cdr (assoc 'arguments invocation))
959 callback)))
960
961(defun doc-view-djvu->png-1 (djvu png page callback)
962 "Convert a PAGE of a DJVU file to bitmap asynchronously.
963Call CALLBACK with no arguments when done."
964 (let ((invocation (funcall doc-view-djvu->png-converter-function
965 (round doc-view-resolution) djvu png page)))
966 (doc-view-start-process
967 "djvu->png" (cdr (assoc 'command invocation))
968 (cdr (assoc 'arguments invocation))
969 callback)))
970
971(declare-function clear-image-cache "image.c" (&optional filter)) 943(declare-function clear-image-cache "image.c" (&optional filter))
972 944
973(defun doc-view-document->png (pdf png pages single-page-converter) 945(defun doc-view-document->bitmap (pdf png pages)
974 ;; FIXME: Fix docstring. 946 "Convert a document file to bitmap images asynchronously.
975 "Convert a PDF file to PNG asynchronously.
976Start by converting PAGES, and then the rest." 947Start by converting PAGES, and then the rest."
977 (if (null pages) 948 (if (null pages)
978 (doc-view-pdf/ps->png pdf png) 949 (doc-view-pdf/ps->png pdf png)
@@ -981,11 +952,11 @@ Start by converting PAGES, and then the rest."
981 ;; a single page anyway, and of the remaining 1%, few cases will have 952 ;; a single page anyway, and of the remaining 1%, few cases will have
982 ;; consecutive pages, it's not worth the trouble. 953 ;; consecutive pages, it's not worth the trouble.
983 (let ((rest (cdr pages))) 954 (let ((rest (cdr pages)))
984 (funcall single-page-converter 955 (funcall doc-view-single-page-converter-function
985 pdf (format png (car pages)) (car pages) 956 pdf (format png (car pages)) (car pages)
986 (lambda () 957 (lambda ()
987 (if rest 958 (if rest
988 (doc-view-document->png pdf png rest) 959 (doc-view-document->bitmap pdf png rest)
989 ;; Yippie, the important pages are done, update the display. 960 ;; Yippie, the important pages are done, update the display.
990 (clear-image-cache) 961 (clear-image-cache)
991 ;; For the windows that have a message (like "Welcome to 962 ;; For the windows that have a message (like "Welcome to
@@ -1065,7 +1036,7 @@ Those files are saved in the directory given by the function
1065 ;; resets during the redisplay). 1036 ;; resets during the redisplay).
1066 (setq doc-view-pending-cache-flush t) 1037 (setq doc-view-pending-cache-flush t)
1067 (let ((png-file (expand-file-name 1038 (let ((png-file (expand-file-name
1068 (concat "page-%d." doc-view--image-file-extension) 1039 (format doc-view--image-file-pattern "%d")
1069 (doc-view-current-cache-dir)))) 1040 (doc-view-current-cache-dir))))
1070 (make-directory (doc-view-current-cache-dir) t) 1041 (make-directory (doc-view-current-cache-dir) t)
1071 (pcase doc-view-doc-type 1042 (pcase doc-view-doc-type
@@ -1092,15 +1063,10 @@ Those files are saved in the directory given by the function
1092 ;; Rename to doc.pdf 1063 ;; Rename to doc.pdf
1093 (rename-file opdf pdf) 1064 (rename-file opdf pdf)
1094 (doc-view-pdf/ps->png pdf png-file))))) 1065 (doc-view-pdf/ps->png pdf png-file)))))
1095 (`pdf 1066 ((or `pdf `djvu)
1096 (let ((pages (doc-view-active-pages)))
1097 ;; Convert PDF to PNG images starting with the active pages.
1098 (doc-view-document->png doc-view-buffer-file-name png-file pages
1099 'doc-view-pdf->png-1)))
1100 (`djvu
1101 (let ((pages (doc-view-active-pages))) 1067 (let ((pages (doc-view-active-pages)))
1102 (doc-view-document->png doc-view-buffer-file-name png-file pages 1068 ;; Convert doc to bitmap images starting with the active pages.
1103 'doc-view-djvu->png-1))) 1069 (doc-view-document->bitmap doc-view-buffer-file-name png-file pages)))
1104 (_ 1070 (_
1105 ;; Convert to PNG images. 1071 ;; Convert to PNG images.
1106 (doc-view-pdf/ps->png doc-view-buffer-file-name png-file))))) 1072 (doc-view-pdf/ps->png doc-view-buffer-file-name png-file)))))
@@ -1211,9 +1177,10 @@ much more accurate than could be done manually using
1211 (let* ((is (image-size (doc-view-current-image) t)) 1177 (let* ((is (image-size (doc-view-current-image) t))
1212 (iw (car is)) 1178 (iw (car is))
1213 (ih (cdr is)) 1179 (ih (cdr is))
1214 (ps (or (and (null force-paper-size) (doc-view-guess-paper-size iw ih)) 1180 (ps (or (and (null force-paper-size)
1181 (doc-view-guess-paper-size iw ih))
1215 (intern (completing-read "Paper size: " 1182 (intern (completing-read "Paper size: "
1216 (mapcar #'car doc-view-paper-sizes) 1183 doc-view-paper-sizes
1217 nil t)))) 1184 nil t))))
1218 (bb (doc-view-scale-bounding-box ps iw ih bb)) 1185 (bb (doc-view-scale-bounding-box ps iw ih bb))
1219 (x1 (nth 0 bb)) 1186 (x1 (nth 0 bb))
@@ -1294,16 +1261,15 @@ have the page we want to view."
1294 (let ((prev-pages doc-view-current-files)) 1261 (let ((prev-pages doc-view-current-files))
1295 (setq doc-view-current-files 1262 (setq doc-view-current-files
1296 (sort (directory-files (doc-view-current-cache-dir) t 1263 (sort (directory-files (doc-view-current-cache-dir) t
1297 (concat "page-[0-9]+\\." 1264 (format doc-view--image-file-pattern
1298 doc-view--image-file-extension) 1265 "[0-9]+")
1299 t) 1266 t)
1300 'doc-view-sort)) 1267 'doc-view-sort))
1301 (dolist (win (or (get-buffer-window-list buffer nil t) 1268 (dolist (win (or (get-buffer-window-list buffer nil t)
1302 (list t))) 1269 (list t)))
1303 (let* ((page (doc-view-current-page win)) 1270 (let* ((page (doc-view-current-page win))
1304 (pagefile (expand-file-name 1271 (pagefile (expand-file-name
1305 (format "page-%d.%s" 1272 (format doc-view--image-file-pattern page)
1306 page doc-view--image-file-extension)
1307 (doc-view-current-cache-dir)))) 1273 (doc-view-current-cache-dir))))
1308 (when (or force 1274 (when (or force
1309 (and (not (member pagefile prev-pages)) 1275 (and (not (member pagefile prev-pages))
@@ -1369,7 +1335,7 @@ For now these keys are useful:
1369 (doc-view-kill-proc) 1335 (doc-view-kill-proc)
1370 (setq buffer-read-only nil) 1336 (setq buffer-read-only nil)
1371 (remove-overlays (point-min) (point-max) 'doc-view t) 1337 (remove-overlays (point-min) (point-max) 'doc-view t)
1372 (set (make-local-variable 'image-mode-winprops-alist) t) 1338 (setq-local image-mode-winprops-alist t)
1373 ;; Switch to the previously used major mode or fall back to 1339 ;; Switch to the previously used major mode or fall back to
1374 ;; normal mode. 1340 ;; normal mode.
1375 (doc-view-fallback-mode) 1341 (doc-view-fallback-mode)
@@ -1499,7 +1465,7 @@ If BACKWARD is non-nil, jump to the previous match."
1499 (doc-view-current-cache-dir))) 1465 (doc-view-current-cache-dir)))
1500 (> (length (directory-files 1466 (> (length (directory-files
1501 (doc-view-current-cache-dir) 1467 (doc-view-current-cache-dir)
1502 nil (concat "\\." doc-view--image-file-extension "\\'"))) 1468 nil (format doc-view--image-file-pattern "[0-9]+")))
1503 0))) 1469 0)))
1504 1470
1505(defun doc-view-initiate-display () 1471(defun doc-view-initiate-display ()
@@ -1511,7 +1477,7 @@ If BACKWARD is non-nil, jump to the previous match."
1511 (if (doc-view-already-converted-p) 1477 (if (doc-view-already-converted-p)
1512 (progn 1478 (progn
1513 (message "DocView: using cached files!") 1479 (message "DocView: using cached files!")
1514 ;; Load the saved resolution 1480 ;; Load the saved resolution.
1515 (let* ((res-file (expand-file-name "resolution.el" 1481 (let* ((res-file (expand-file-name "resolution.el"
1516 (doc-view-current-cache-dir))) 1482 (doc-view-current-cache-dir)))
1517 (res 1483 (res
@@ -1520,7 +1486,7 @@ If BACKWARD is non-nil, jump to the previous match."
1520 (insert-file-contents res-file) 1486 (insert-file-contents res-file)
1521 (read (current-buffer)))))) 1487 (read (current-buffer))))))
1522 (when (numberp res) 1488 (when (numberp res)
1523 (set (make-local-variable 'doc-view-resolution) res))) 1489 (setq-local doc-view-resolution res)))
1524 (doc-view-display (current-buffer) 'force)) 1490 (doc-view-display (current-buffer) 'force))
1525 (doc-view-convert-current-doc)) 1491 (doc-view-convert-current-doc))
1526 (message 1492 (message
@@ -1590,23 +1556,23 @@ If BACKWARD is non-nil, jump to the previous match."
1590 ((looking-at "%PDF") '(pdf)) 1556 ((looking-at "%PDF") '(pdf))
1591 ((looking-at "\367\002") '(dvi)) 1557 ((looking-at "\367\002") '(dvi))
1592 ((looking-at "AT&TFORM") '(djvu)))))) 1558 ((looking-at "AT&TFORM") '(djvu))))))
1593 (set (make-local-variable 'doc-view-doc-type) 1559 (setq-local doc-view-doc-type
1594 (car (or (doc-view-intersection name-types content-types) 1560 (car (or (doc-view-intersection name-types content-types)
1595 (when (and name-types content-types) 1561 (when (and name-types content-types)
1596 (error "Conflicting types: name says %s but content says %s" 1562 (error "Conflicting types: name says %s but content says %s"
1597 name-types content-types)) 1563 name-types content-types))
1598 name-types content-types 1564 name-types content-types
1599 (error "Cannot determine the document type")))))) 1565 (error "Cannot determine the document type"))))))
1600 1566
1601(defun doc-view-set-up-single-converter () 1567(defun doc-view-set-up-single-converter ()
1602 "Find the right single-page converter for the current document type" 1568 "Find the right single-page converter for the current document type"
1603 (pcase-let ((`(,conv-function ,type ,extension) 1569 (pcase-let ((`(,conv-function ,type ,extension)
1604 (pcase doc-view-doc-type 1570 (pcase doc-view-doc-type
1605 (`djvu (list #'doc-view-djvu->png-1 'tiff "tif")) 1571 (`djvu (list #'doc-view-djvu->tiff-converter-ddjvu 'tiff "tif"))
1606 (_ (list #'doc-view-pdf->png-1 'png "png"))))) 1572 (_ (list doc-view-pdf->png-converter-function 'png "png")))))
1607 (setq-local doc-view-single-page-converter-function conv-function) 1573 (setq-local doc-view-single-page-converter-function conv-function)
1608 (setq-local doc-view--image-type type) 1574 (setq-local doc-view--image-type type)
1609 (setq-local doc-view--image-file-extension extension))) 1575 (setq-local doc-view--image-file-pattern (concat "page-%s." extension))))
1610 1576
1611;;;###autoload 1577;;;###autoload
1612(defun doc-view-mode () 1578(defun doc-view-mode ()
@@ -1631,8 +1597,7 @@ toggle between displaying the document or editing it as text.
1631 (unless (eq major-mode 'fundamental-mode) 1597 (unless (eq major-mode 'fundamental-mode)
1632 major-mode)))) 1598 major-mode))))
1633 (kill-all-local-variables) 1599 (kill-all-local-variables)
1634 (set (make-local-variable 'doc-view-previous-major-mode) 1600 (setq-local doc-view-previous-major-mode prev-major-mode))
1635 prev-major-mode))
1636 1601
1637 (dolist (var doc-view-saved-settings) 1602 (dolist (var doc-view-saved-settings)
1638 (set (make-local-variable (car var)) (cdr var))) 1603 (set (make-local-variable (car var)) (cdr var)))
@@ -1644,7 +1609,7 @@ toggle between displaying the document or editing it as text.
1644 1609
1645 (doc-view-make-safe-dir doc-view-cache-directory) 1610 (doc-view-make-safe-dir doc-view-cache-directory)
1646 ;; Handle compressed files, remote files, files inside archives 1611 ;; Handle compressed files, remote files, files inside archives
1647 (set (make-local-variable 'doc-view-buffer-file-name) 1612 (setq-local doc-view-buffer-file-name
1648 (cond 1613 (cond
1649 (jka-compr-really-do-compress 1614 (jka-compr-really-do-compress
1650 ;; FIXME: there's a risk of name conflicts here. 1615 ;; FIXME: there's a risk of name conflicts here.
@@ -1683,20 +1648,19 @@ toggle between displaying the document or editing it as text.
1683 'doc-view-new-window-function nil t) 1648 'doc-view-new-window-function nil t)
1684 (image-mode-setup-winprops) 1649 (image-mode-setup-winprops)
1685 1650
1686 (set (make-local-variable 'mode-line-position) 1651 (setq-local mode-line-position
1687 '(" P" (:eval (number-to-string (doc-view-current-page))) 1652 '(" P" (:eval (number-to-string (doc-view-current-page)))
1688 "/" (:eval (number-to-string (doc-view-last-page-number))))) 1653 "/" (:eval (number-to-string (doc-view-last-page-number)))))
1689 ;; Don't scroll unless the user specifically asked for it. 1654 ;; Don't scroll unless the user specifically asked for it.
1690 (set (make-local-variable 'auto-hscroll-mode) nil) 1655 (setq-local auto-hscroll-mode nil)
1691 (set (make-local-variable 'mwheel-scroll-up-function) 1656 (setq-local mwheel-scroll-up-function #'doc-view-scroll-up-or-next-page)
1692 'doc-view-scroll-up-or-next-page) 1657 (setq-local mwheel-scroll-down-function
1693 (set (make-local-variable 'mwheel-scroll-down-function) 1658 #'doc-view-scroll-down-or-previous-page)
1694 'doc-view-scroll-down-or-previous-page) 1659 (setq-local cursor-type nil)
1695 (set (make-local-variable 'cursor-type) nil)
1696 (use-local-map doc-view-mode-map) 1660 (use-local-map doc-view-mode-map)
1697 (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc) 1661 (add-hook 'after-revert-hook 'doc-view-reconvert-doc nil t)
1698 (set (make-local-variable 'bookmark-make-record-function) 1662 (setq-local bookmark-make-record-function
1699 'doc-view-bookmark-make-record) 1663 #'doc-view-bookmark-make-record)
1700 (setq mode-name "DocView" 1664 (setq mode-name "DocView"
1701 buffer-read-only t 1665 buffer-read-only t
1702 major-mode 'doc-view-mode) 1666 major-mode 'doc-view-mode)
@@ -1705,7 +1669,7 @@ toggle between displaying the document or editing it as text.
1705 ;; canonical view mode for PDF/PS/DVI files. This could be 1669 ;; canonical view mode for PDF/PS/DVI files. This could be
1706 ;; switched on automatically depending on the value of 1670 ;; switched on automatically depending on the value of
1707 ;; `view-read-only'. 1671 ;; `view-read-only'.
1708 (set (make-local-variable 'view-read-only) nil) 1672 (setq-local view-read-only nil)
1709 (run-mode-hooks 'doc-view-mode-hook))) 1673 (run-mode-hooks 'doc-view-mode-hook)))
1710 1674
1711(defun doc-view-fallback-mode () 1675(defun doc-view-fallback-mode ()
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el
index 6741094aa55..270badd53cb 100644
--- a/lisp/emacs-lisp/authors.el
+++ b/lisp/emacs-lisp/authors.el
@@ -295,6 +295,14 @@ Changes to files matching one of the regexps in this list are not listed.")
295 "calc/INSTALL" "calc/Makefile" 295 "calc/INSTALL" "calc/Makefile"
296 "vms-pp.trans" "_emacs" "batcomp.com" "notes/cpp" ; admin/ 296 "vms-pp.trans" "_emacs" "batcomp.com" "notes/cpp" ; admin/
297 "emacsver.texi.in" 297 "emacsver.texi.in"
298 "vpath.sed"
299 "Cocoa/Emacs.base/Contents/Info.plist"
300 "Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings"
301 "GNUstep/Emacs.base/Resources/Info-gnustep.plist"
302 "GNUstep/Emacs.base/Resources/Emacs.desktop"
303 "Cocoa/Emacs.base/Contents/Resources/English.lproj"
304 ;; Only existed briefly, then deleted:
305 "coccinelle/overlay.cocci" "coccinelle/symbol.cocci"
298 ;; MH-E stuff not in Emacs: 306 ;; MH-E stuff not in Emacs:
299 "import-emacs" "release-utils" 307 "import-emacs" "release-utils"
300 ;; Erc stuff not in Emacs: 308 ;; Erc stuff not in Emacs:
@@ -540,6 +548,7 @@ Changes to files in this list are not listed.")
540 "makedist.bat" 548 "makedist.bat"
541 "makefile.def" 549 "makefile.def"
542 "makefile.nt" 550 "makefile.nt"
551 "ns.mk"
543 "debug.bat.in" "emacs.bat.in" 552 "debug.bat.in" "emacs.bat.in"
544 ".gdbinit-union" 553 ".gdbinit-union"
545 "alloca.s" 554 "alloca.s"
@@ -553,15 +562,17 @@ Changes to files in this list are not listed.")
553 "ymakefile" 562 "ymakefile"
554 "permute-index" "index.perm" 563 "permute-index" "index.perm"
555 "ibmrs6000.inp" 564 "ibmrs6000.inp"
556 "b2m.c" "b2m.1" "b2m.pl" 565 "b2m.c" "b2m.1" "b2m.pl" "rcs-checkin.1"
557 "emacs.bash" "emacs.csh" "ms-kermit" 566 "emacs.bash" "emacs.csh" "ms-kermit"
558 "emacs.ico" 567 "emacs.ico"
559 "emacs21.ico" 568 "emacs21.ico"
569 "emacs.py" "emacs2.py" "emacs3.py"
560 "BABYL" "LPF" "LEDIT" "OTHER.EMACSES" 570 "BABYL" "LPF" "LEDIT" "OTHER.EMACSES"
561 "emacs16_mac.png" "emacs24_mac.png" 571 "emacs16_mac.png" "emacs24_mac.png"
562 "emacs256_mac.png" "emacs32_mac.png" 572 "emacs256_mac.png" "emacs32_mac.png"
563 "emacs48_mac.png" "emacs512_mac.png" 573 "emacs48_mac.png" "emacs512_mac.png"
564 "revdiff" ; admin/ 574 "revdiff" ; admin/
575 "vcdiff" "rcs-checkin" "tindex.pl"
565 "mainmake" "sed1.inp" "sed2.inp" "sed3.inp" ; msdos/ 576 "mainmake" "sed1.inp" "sed2.inp" "sed3.inp" ; msdos/
566 "mac-fix-env.m" 577 "mac-fix-env.m"
567 ;; Deleted vms stuff: 578 ;; Deleted vms stuff:
@@ -580,6 +591,7 @@ in the repository.")
580 ("s/windowsnt.h" . "s/ms-w32.h") 591 ("s/windowsnt.h" . "s/ms-w32.h")
581 ("s/ms-w32.h" . "inc/ms-w32.h") 592 ("s/ms-w32.h" . "inc/ms-w32.h")
582 ("winnt.el" . "w32-fns.el") 593 ("winnt.el" . "w32-fns.el")
594 ("emacs.manifest" . "emacs-x86.manifest")
583 ("config.emacs" . "configure") 595 ("config.emacs" . "configure")
584 ("configure.in" . "configure.ac") 596 ("configure.in" . "configure.ac")
585 ("config.h.dist" . "config.in") 597 ("config.h.dist" . "config.in")
@@ -616,6 +628,8 @@ in the repository.")
616 ("build-install" . "build-ins.in") 628 ("build-install" . "build-ins.in")
617 ("build-install.in" . "build-ins.in") 629 ("build-install.in" . "build-ins.in")
618 ("unidata/Makefile" . "unidata/Makefile.in") 630 ("unidata/Makefile" . "unidata/Makefile.in")
631 ("move-if-change" . "build-aux/move-if-change")
632 ("update-subdirs" . "build-aux/update-subdirs")
619 ;; Not renamed, but we only have the latter in the Emacs repo. 633 ;; Not renamed, but we only have the latter in the Emacs repo.
620 ("trampver.texi.in" . "trampver.texi") 634 ("trampver.texi.in" . "trampver.texi")
621 ("e/eterm" . "e/eterm-color") 635 ("e/eterm" . "e/eterm-color")
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 5607c9b0698..f88cb0ef9bb 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -30,12 +30,12 @@
30;; a single prompt, optionally using completion. 30;; a single prompt, optionally using completion.
31 31
32;; Multiple strings are specified by separating each of the strings 32;; Multiple strings are specified by separating each of the strings
33;; with a prespecified separator character. For example, if the 33;; with a prespecified separator regexp. For example, if the
34;; separator character is a comma, the strings 'alice', 'bob', and 34;; separator regexp is ",", the strings 'alice', 'bob', and
35;; 'eve' would be specified as 'alice,bob,eve'. 35;; 'eve' would be specified as 'alice,bob,eve'.
36 36
37;; The default value for the separator character is the value of 37;; The default value for the separator regexp is the value of
38;; `crm-default-separator' (comma). The separator character may be 38;; `crm-default-separator' (comma). The separator regexp may be
39;; changed by modifying the value of `crm-separator'. 39;; changed by modifying the value of `crm-separator'.
40 40
41;; Contiguous strings of non-separator-characters are referred to as 41;; Contiguous strings of non-separator-characters are referred to as
@@ -96,14 +96,14 @@
96;; first revamped version 96;; first revamped version
97 97
98;;; Code: 98;;; Code:
99(defconst crm-default-separator "," 99(defconst crm-default-separator "[ \t]*,[ \t]*"
100 "Default separator for `completing-read-multiple'.") 100 "Default separator regexp for `completing-read-multiple'.")
101 101
102(defvar crm-separator crm-default-separator 102(defvar crm-separator crm-default-separator
103 "Separator used for separating strings in `completing-read-multiple'. 103 "Separator regexp used for separating strings in `completing-read-multiple'.
104It should be a single character string that doesn't appear in the list of 104It should be a regexp that does not match the list of completion candidates.
105completion candidates. Modify this value to make `completing-read-multiple' 105Modify this value to make `completing-read-multiple' use a separator other
106use a separator other than `crm-default-separator'.") 106than `crm-default-separator'.")
107 107
108(defvar crm-local-completion-map 108(defvar crm-local-completion-map
109 (let ((map (make-sparse-keymap))) 109 (let ((map (make-sparse-keymap)))
@@ -173,13 +173,17 @@ Place an overlay on the element, with a `field' property, and return it."
173 (overlay-put ol 'field (make-symbol "crm")) 173 (overlay-put ol 'field (make-symbol "crm"))
174 ol)) 174 ol))
175 175
176(defmacro crm--completion-command (command)
177 "Make COMMAND a completion command for `completing-read-multiple'."
178 `(let ((ol (crm--select-current-element)))
179 (unwind-protect
180 ,command
181 (delete-overlay ol))))
182
176(defun crm-completion-help () 183(defun crm-completion-help ()
177 "Display a list of possible completions of the current minibuffer element." 184 "Display a list of possible completions of the current minibuffer element."
178 (interactive) 185 (interactive)
179 (let ((ol (crm--select-current-element))) 186 (crm--completion-command (minibuffer-completion-help))
180 (unwind-protect
181 (minibuffer-completion-help)
182 (delete-overlay ol)))
183 nil) 187 nil)
184 188
185(defun crm-complete () 189(defun crm-complete ()
@@ -188,19 +192,13 @@ If no characters can be completed, display a list of possible completions.
188 192
189Return t if the current element is now a valid match; otherwise return nil." 193Return t if the current element is now a valid match; otherwise return nil."
190 (interactive) 194 (interactive)
191 (let ((ol (crm--select-current-element))) 195 (crm--completion-command (minibuffer-complete)))
192 (unwind-protect
193 (minibuffer-complete)
194 (delete-overlay ol))))
195 196
196(defun crm-complete-word () 197(defun crm-complete-word ()
197 "Complete the current element at most a single word. 198 "Complete the current element at most a single word.
198Like `minibuffer-complete-word' but for `completing-read-multiple'." 199Like `minibuffer-complete-word' but for `completing-read-multiple'."
199 (interactive) 200 (interactive)
200 (let ((ol (crm--select-current-element))) 201 (crm--completion-command (minibuffer-complete-word)))
201 (unwind-protect
202 (minibuffer-complete-word)
203 (delete-overlay ol))))
204 202
205(defun crm-complete-and-exit () 203(defun crm-complete-and-exit ()
206 "If all of the minibuffer elements are valid completions then exit. 204 "If all of the minibuffer elements are valid completions then exit.
@@ -222,9 +220,10 @@ This function is modeled after `minibuffer-complete-and-exit'."
222 (setq doexit nil)) 220 (setq doexit nil))
223 (goto-char (overlay-end ol)) 221 (goto-char (overlay-end ol))
224 (delete-overlay ol)) 222 (delete-overlay ol))
225 (not (eobp)))) 223 (not (eobp)))
224 (looking-at crm-separator))
226 ;; Skip to the next element. 225 ;; Skip to the next element.
227 (forward-char 1)) 226 (goto-char (match-end 0)))
228 (if doexit (exit-minibuffer)))) 227 (if doexit (exit-minibuffer))))
229 228
230(defun crm--choose-completion-string (choice buffer base-position 229(defun crm--choose-completion-string (choice buffer base-position
@@ -248,12 +247,12 @@ By using this functionality, a user may specify multiple strings at a
248single prompt, optionally using completion. 247single prompt, optionally using completion.
249 248
250Multiple strings are specified by separating each of the strings with 249Multiple strings are specified by separating each of the strings with
251a prespecified separator character. For example, if the separator 250a prespecified separator regexp. For example, if the separator
252character is a comma, the strings 'alice', 'bob', and 'eve' would be 251regexp is \",\", the strings 'alice', 'bob', and 'eve' would be
253specified as 'alice,bob,eve'. 252specified as 'alice,bob,eve'.
254 253
255The default value for the separator character is the value of 254The default value for the separator regexp is the value of
256`crm-default-separator' (comma). The separator character may be 255`crm-default-separator' (comma). The separator regexp may be
257changed by modifying the value of `crm-separator'. 256changed by modifying the value of `crm-separator'.
258 257
259Contiguous strings of non-separator-characters are referred to as 258Contiguous strings of non-separator-characters are referred to as
@@ -282,8 +281,8 @@ INHERIT-INPUT-METHOD."
282 (map (if require-match 281 (map (if require-match
283 crm-local-must-match-map 282 crm-local-must-match-map
284 crm-local-completion-map)) 283 crm-local-completion-map))
285 ;; If the user enters empty input, read-from-minibuffer returns 284 ;; If the user enters empty input, `read-from-minibuffer'
286 ;; the empty string, not DEF. 285 ;; returns the empty string, not DEF.
287 (input (read-from-minibuffer 286 (input (read-from-minibuffer
288 prompt initial-input map 287 prompt initial-input map
289 nil hist def inherit-input-method))) 288 nil hist def inherit-input-method)))
diff --git a/lisp/faces.el b/lisp/faces.el
index f78a4cb9e3d..60410733514 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -929,27 +929,29 @@ of the default face. Value is FACE."
929;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 929;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
930 930
931(defun read-face-name (prompt &optional default multiple) 931(defun read-face-name (prompt &optional default multiple)
932 "Read a face, defaulting to the face or faces at point. 932 "Read one or more face names, defaulting to the face(s) at point.
933If the text at point has the property `read-face-name', that 933PROMPT should be a prompt string; it should not end in a space or
934overrides the `face' property for determining the default. 934a colon.
935 935
936PROMPT should be a string that describes what the caller will do 936The optional argument DEFAULT specifies the default face name(s)
937with the face; it should not end in a space. 937to return if the user just types RET. If its value is non-nil,
938it should be a list of face names (symbols); in that case, the
939default return value is the `car' of DEFAULT (if the argument
940MULTIPLE is non-nil), or DEFAULT (if MULTIPLE is nil). See below
941for the meaning of MULTIPLE.
938 942
943If DEFAULT is nil, the list of default face names is taken from
944the `read-face-name' property of the text at point, or, if that
945is nil, from the `face' property of the text at point.
939 946
940This function uses `completing-read-multiple' with \",\" as the 947This function uses `completing-read-multiple' with \",\" as the
941separator character, i.e. 948separator character. Thus, the user may enter multiple face
942 949names, separated by commas. The optional argument MULTIPLE
943 950specifies the form of the return value. If MULTIPLE is non-nil,
944 951return a list of face names; if the user entered just one face
945 952name, the return value would be a list of one face name.
946 953Otherwise, return a single face name; if the user entered more
947The optional argument DEFAULT provides the value to display in the 954than one face name, return only the first one."
948minibuffer prompt that is returned if the user just types RET
949unless DEFAULT is a string (in which case nil is returned).
950
951If MULTIPLE is non-nil, return a list of faces (possibly only one).
952Otherwise, return a single face."
953 (let ((faceprop (or (get-char-property (point) 'read-face-name) 955 (let ((faceprop (or (get-char-property (point) 'read-face-name)
954 (get-char-property (point) 'face))) 956 (get-char-property (point) 'face)))
955 (aliasfaces nil) 957 (aliasfaces nil)
diff --git a/lisp/files.el b/lisp/files.el
index ca5a415fb8e..b015b53db3c 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2357,7 +2357,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . archive-mode)
2357 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) 2357 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
2358 ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG 2358 ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG
2359 ("\\.[eE]?[pP][sS]\\'" . ps-mode) 2359 ("\\.[eE]?[pP][sS]\\'" . ps-mode)
2360 ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe) 2360 ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|djvu\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe)
2361 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode) 2361 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
2362 ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode) 2362 ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
2363 ("BROWSE\\'" . ebrowse-tree-mode) 2363 ("BROWSE\\'" . ebrowse-tree-mode)
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 90eb5dfaec5..a95dde1d999 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -63,8 +63,9 @@ otherwise it defaults to t, used for times when the buffer is not displayed."
63 (when cleanup 63 (when cleanup
64 (setq image-mode-winprops-alist 64 (setq image-mode-winprops-alist
65 (delq nil (mapcar (lambda (winprop) 65 (delq nil (mapcar (lambda (winprop)
66 (if (window-live-p (car-safe winprop)) 66 (let ((w (car-safe winprop)))
67 winprop)) 67 (if (or (not (windowp w)) (window-live-p w))
68 winprop)))
68 image-mode-winprops-alist)))) 69 image-mode-winprops-alist))))
69 (let ((winprops (assq window image-mode-winprops-alist))) 70 (let ((winprops (assq window image-mode-winprops-alist)))
70 ;; For new windows, set defaults from the latest. 71 ;; For new windows, set defaults from the latest.
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 0bfee770094..f64d1afe951 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -447,6 +447,8 @@ Don't move point."
447Simple elements in the alist look like (INDEX-NAME . POSITION). 447Simple elements in the alist look like (INDEX-NAME . POSITION).
448POSITION is the buffer position of the item; to go to the item 448POSITION is the buffer position of the item; to go to the item
449is simply to move point to that position. 449is simply to move point to that position.
450POSITION is passed to `imenu-default-goto-function', so it can be a non-number
451if that variable has been changed (e.g. Semantic uses overlays for POSITIONs).
450 452
451Special elements look like (INDEX-NAME POSITION FUNCTION ARGUMENTS...). 453Special elements look like (INDEX-NAME POSITION FUNCTION ARGUMENTS...).
452To \"go to\" a special element means applying FUNCTION 454To \"go to\" a special element means applying FUNCTION
diff --git a/lisp/man.el b/lisp/man.el
index b6a6c179374..93a67128de4 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1,4 +1,4 @@
1;;; man.el --- browse UNIX manual pages -*- coding: iso-8859-1 -*- 1;;; man.el --- browse UNIX manual pages -*- coding: utf-8 -*-
2 2
3;; Copyright (C) 1993-1994, 1996-1997, 2001-2013 Free Software 3;; Copyright (C) 1993-1994, 1996-1997, 2001-2013 Free Software
4;; Foundation, Inc. 4;; Foundation, Inc.
@@ -276,7 +276,7 @@ Used in `bookmark-set' to get the default bookmark name."
276 :type 'hook 276 :type 'hook
277 :group 'man) 277 :group 'man)
278 278
279(defvar Man-name-regexp "[-a-zA-Z0-9_­+][-a-zA-Z0-9_.:­+]*" 279(defvar Man-name-regexp "[-a-zA-Z0-9_­+][-a-zA-Z0-9_.:­+]*"
280 "Regular expression describing the name of a manpage (without section).") 280 "Regular expression describing the name of a manpage (without section).")
281 281
282(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]" 282(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
@@ -780,6 +780,59 @@ POS defaults to `point'."
780 ;; but apparently that's not the case in all cases, so let's add a cache. 780 ;; but apparently that's not the case in all cases, so let's add a cache.
781 "Cache of completion table of the form (PREFIX . TABLE).") 781 "Cache of completion table of the form (PREFIX . TABLE).")
782 782
783(defvar Man-man-k-use-anchor
784 ;; man-db or man-1.*
785 (memq system-type '(gnu gnu/linux gnu/kfreebsd))
786 "If non-nil prepend ^ to the prefix passed to \"man -k\" for completion.
787The value should be nil if \"man -k ^PREFIX\" may omit some man
788pages whose names start with PREFIX.
789
790Currently, the default value depends on `system-type' and is
791non-nil where the standard man programs are known to behave
792properly. Setting the value to nil always gives correct results
793but computing the list of completions may take a bit longer.")
794
795(defun Man-parse-man-k ()
796 "Parse \"man -k\" output and return the list of page names.
797
798The current buffer should contain the output of a command of the
799form \"man -k keyword\", which is traditionally also available with
800apropos(1).
801
802While POSIX man(1p) is a bit vague about what to expect here,
803this function tries to parse some commonly used formats, which
804can be described in the following informal way, with square brackets
805indicating optional parts and whitespace being interpreted
806somewhat loosely.
807
808foo[, bar [, ...]] [other stuff] (sec) - description
809foo(sec)[, bar(sec) [, ...]] [other stuff] - description
810
811For more details and some regression tests, please see
812test/automated/man-tests.el in the emacs bzr repository."
813 (goto-char (point-min))
814 ;; See man-tests for data about which systems use which format (hopefully we
815 ;; will be able to simplify the code if/when some of those formats aren't
816 ;; used any more).
817 (let (table)
818 (while (search-forward-regexp "^\\([^ \t,\n]+\\)\\(.*?\\)\
819\\(?:[ \t]\\(([^ \t,\n]+?)\\)\\)?\\(?:[ \t]+- ?\\(.*\\)\\)?$" nil t)
820 (let ((section (match-string 3))
821 (description (match-string 4))
822 (bound (match-end 2)))
823 (goto-char (match-end 1))
824 (while
825 (progn
826 ;; The first regexp grouping may already match the section
827 ;; tacked on to the name, which is ok since for the formats we
828 ;; claim to support the third (non-shy) grouping does not
829 ;; match in this case, i.e., section is nil.
830 (push (propertize (concat (match-string 1) section)
831 'help-echo description)
832 table)
833 (search-forward-regexp "\\=, *\\([^ \t,]+\\)" bound t)))))
834 (nreverse table)))
835
783(defun Man-completion-table (string pred action) 836(defun Man-completion-table (string pred action)
784 (cond 837 (cond
785 ;; This ends up returning t for pretty much any string, and hence leads to 838 ;; This ends up returning t for pretty much any string, and hence leads to
@@ -811,16 +864,15 @@ POS defaults to `point'."
811 ;; run differently in Man-getpage-in-background, an error 864 ;; run differently in Man-getpage-in-background, an error
812 ;; here may not necessarily mean that we'll also get an 865 ;; here may not necessarily mean that we'll also get an
813 ;; error later. 866 ;; error later.
814 (ignore-errors 867 (ignore-errors
815 (call-process manual-program nil '(t nil) nil 868 (call-process manual-program nil '(t nil) nil
816 "-k" (concat "^" prefix)))) 869 "-k" (concat (when (or Man-man-k-use-anchor
817 (goto-char (point-min)) 870 (string-equal prefix ""))
818 (while (re-search-forward "^\\([^ \t\n]+\\)\\(?: ?\\((.+?)\\)\\(?:[ \t]+- \\(.*\\)\\)?\\)?" nil t) 871 "^")
819 (push (propertize (concat (match-string 1) (match-string 2)) 872 prefix))))
820 'help-echo (match-string 3)) 873 (setq table (Man-parse-man-k)))
821 table))) 874 ;; Cache the table for later reuse.
822 ;; Cache the table for later reuse. 875 (setq Man-completion-cache (cons prefix table)))
823 (setq Man-completion-cache (cons prefix table)))
824 ;; The table may contain false positives since the match is made 876 ;; The table may contain false positives since the match is made
825 ;; by "man -k" not just on the manpage's name. 877 ;; by "man -k" not just on the manpage's name.
826 (if section 878 (if section
@@ -891,6 +943,7 @@ names or descriptions. The pattern argument is usually an
891 ;; ("man -k" is case-insensitive similarly, so the 943 ;; ("man -k" is case-insensitive similarly, so the
892 ;; table has everything available to complete) 944 ;; table has everything available to complete)
893 (completion-ignore-case t) 945 (completion-ignore-case t)
946 Man-completion-cache ;Don't cache across calls.
894 (input (completing-read 947 (input (completing-read
895 (format "Manual entry%s" 948 (format "Manual entry%s"
896 (if (string= default-entry "") 949 (if (string= default-entry "")
@@ -1395,7 +1448,7 @@ The following key bindings are currently in effect in the buffer:
1395 ;; Update len, in case a reference spans 1448 ;; Update len, in case a reference spans
1396 ;; more than two lines (paranoia). 1449 ;; more than two lines (paranoia).
1397 len (1- (length word)))) 1450 len (1- (length word))))
1398 (if (memq (aref word len) '(?- ?­)) 1451 (if (memq (aref word len) '(?- ?­))
1399 (setq hyphenated (substring word 0 len))) 1452 (setq hyphenated (substring word 0 len)))
1400 (and (string-match Man-reference-regexp word) 1453 (and (string-match Man-reference-regexp word)
1401 (not (member word Man--refpages)) 1454 (not (member word Man--refpages))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 6ffa67f59c1..560b66bf3b0 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -2464,8 +2464,12 @@ comment at the start of cc-engine.el for more info."
2464 2464
2465;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2465;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2466;; Variables which keep track of preprocessor constructs. 2466;; Variables which keep track of preprocessor constructs.
2467(defvar c-state-old-cpp-beg-marker nil)
2468(make-variable-buffer-local 'c-state-old-cpp-beg-marker)
2467(defvar c-state-old-cpp-beg nil) 2469(defvar c-state-old-cpp-beg nil)
2468(make-variable-buffer-local 'c-state-old-cpp-beg) 2470(make-variable-buffer-local 'c-state-old-cpp-beg)
2471(defvar c-state-old-cpp-end-marker nil)
2472(make-variable-buffer-local 'c-state-old-cpp-end-marker)
2469(defvar c-state-old-cpp-end nil) 2473(defvar c-state-old-cpp-end nil)
2470(make-variable-buffer-local 'c-state-old-cpp-end) 2474(make-variable-buffer-local 'c-state-old-cpp-end)
2471;; These are the limits of the macro containing point at the previous call of 2475;; These are the limits of the macro containing point at the previous call of
@@ -2653,13 +2657,21 @@ comment at the start of cc-engine.el for more info."
2653 ;; reduce the time wasted in repeated fruitless searches in brace deserts. 2657 ;; reduce the time wasted in repeated fruitless searches in brace deserts.
2654 (save-excursion 2658 (save-excursion
2655 (save-restriction 2659 (save-restriction
2656 (let ((bra from) ce ; Positions of "{" and "}". 2660 (let* (new-cons
2657 new-cons 2661 (cache-pos (c-state-cache-top-lparen)) ; might be nil.
2658 (cache-pos (c-state-cache-top-lparen)) ; might be nil. 2662 (macro-start-or-from
2659 (macro-start-or-from 2663 (progn (goto-char from)
2660 (progn (goto-char from) 2664 (c-beginning-of-macro)
2661 (c-beginning-of-macro) 2665 (point)))
2662 (point)))) 2666 (bra ; Position of "{".
2667 ;; Don't start scanning in the middle of a CPP construct unless
2668 ;; it contains HERE - these constructs, in Emacs, are "commented
2669 ;; out" with category properties.
2670 (if (eq (c-get-char-property macro-start-or-from 'category)
2671 'c-cpp-delimiter)
2672 macro-start-or-from
2673 from))
2674 ce) ; Position of "}"
2663 (or upper-lim (setq upper-lim from)) 2675 (or upper-lim (setq upper-lim from))
2664 2676
2665 ;; If we're essentially repeating a fruitless search, just give up. 2677 ;; If we're essentially repeating a fruitless search, just give up.
@@ -2899,7 +2911,9 @@ comment at the start of cc-engine.el for more info."
2899 (point-max) 2911 (point-max)
2900 (min (point-max) c-state-old-cpp-beg))) 2912 (min (point-max) c-state-old-cpp-beg)))
2901 (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim)) 2913 (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim))
2914 (setq scan-back-pos (car-safe (car c-state-cache)))
2902 (setq c-state-cache (cdr c-state-cache))) 2915 (setq c-state-cache (cdr c-state-cache)))
2916
2903 ;; If `upper-lim' is inside the last recorded brace pair, remove its 2917 ;; If `upper-lim' is inside the last recorded brace pair, remove its
2904 ;; RBrace and indicate we'll need to search backwards for a previous 2918 ;; RBrace and indicate we'll need to search backwards for a previous
2905 ;; brace pair. 2919 ;; brace pair.
@@ -3324,6 +3338,13 @@ comment at the start of cc-engine.el for more info."
3324 (c-with-cpps-commented-out 3338 (c-with-cpps-commented-out
3325 (c-invalidate-state-cache-1 here))))) 3339 (c-invalidate-state-cache-1 here)))))
3326 3340
3341(defmacro c-state-maybe-marker (place marker)
3342 ;; If PLACE is non-nil, return a marker marking it, otherwise nil.
3343 ;; We (re)use MARKER.
3344 `(and ,place
3345 (or ,marker (setq ,marker (make-marker)))
3346 (set-marker ,marker ,place)))
3347
3327(defun c-parse-state () 3348(defun c-parse-state ()
3328 ;; This is a wrapper over `c-parse-state-1'. See that function for a 3349 ;; This is a wrapper over `c-parse-state-1'. See that function for a
3329 ;; description of the functionality and return value. 3350 ;; description of the functionality and return value.
@@ -3350,9 +3371,10 @@ comment at the start of cc-engine.el for more info."
3350 (c-parse-state-1)) 3371 (c-parse-state-1))
3351 (c-with-cpps-commented-out 3372 (c-with-cpps-commented-out
3352 (c-parse-state-1)))) 3373 (c-parse-state-1))))
3353 (setq c-state-old-cpp-beg (and here-cpp-beg (copy-marker here-cpp-beg t)) 3374 (setq c-state-old-cpp-beg
3354 c-state-old-cpp-end (and here-cpp-end (copy-marker here-cpp-end t))) 3375 (c-state-maybe-marker here-cpp-beg c-state-old-cpp-beg-marker)
3355 ))) 3376 c-state-old-cpp-end
3377 (c-state-maybe-marker here-cpp-end c-state-old-cpp-end-marker)))))
3356 3378
3357;; Debug tool to catch cache inconsistencies. This is called from 3379;; Debug tool to catch cache inconsistencies. This is called from
3358;; 000tests.el. 3380;; 000tests.el.
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 0279319cc89..adf378f6bc7 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -319,7 +319,9 @@ If no function name is found, return nil."
319 namestack (cons (car pair) namestack) 319 namestack (cons (car pair) namestack)
320 alist (cdr pair))) 320 alist (cdr pair)))
321 321
322 ((number-or-marker-p (setq mark (cdr pair))) 322 ((or (number-or-marker-p (setq mark (cdr pair)))
323 (and (overlayp mark)
324 (setq mark (overlay-start mark))))
323 (when (and (>= (setq offset (- (point) mark)) 0) 325 (when (and (>= (setq offset (- (point) mark)) 0)
324 (< offset minoffset)) ; Find the closest item. 326 (< offset minoffset)) ; Find the closest item.
325 (setq minoffset offset 327 (setq minoffset offset
diff --git a/lisp/simple.el b/lisp/simple.el
index d06a04aa5dc..dcd6d792acb 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1391,14 +1391,16 @@ If the value is non-nil and not a number, we wait 2 seconds."
1391 ;; Aaron S. Hawley <aaron.s.hawley(at)gmail.com> 2009-08-24 1391 ;; Aaron S. Hawley <aaron.s.hawley(at)gmail.com> 2009-08-24
1392 "Read function name, then read its arguments and call it. 1392 "Read function name, then read its arguments and call it.
1393 1393
1394To pass a numeric argument to the command you are invoking with, specify 1394To pass a numeric argument to the command you are invoking, specify
1395the numeric argument to this command. 1395the numeric argument to this command.
1396 1396
1397Noninteractively, the argument PREFIXARG is the prefix argument to 1397Noninteractively, the argument PREFIXARG is the prefix argument to
1398give to the command you invoke, if it asks for an argument." 1398give to the command you invoke, if it asks for an argument."
1399 (interactive (list current-prefix-arg (read-extended-command))) 1399 (interactive (list current-prefix-arg (read-extended-command)))
1400 ;; Emacs<24 calling-convention was with a single `prefixarg' argument. 1400 ;; Emacs<24 calling-convention was with a single `prefixarg' argument.
1401 (if (null command-name) (setq command-name (read-extended-command))) 1401 (if (null command-name)
1402 (setq command-name (let ((current-prefix-arg prefixarg)) ; for prompt
1403 (read-extended-command))))
1402 (let* ((function (and (stringp command-name) (intern-soft command-name))) 1404 (let* ((function (and (stringp command-name) (intern-soft command-name)))
1403 (binding (and suggest-key-bindings 1405 (binding (and suggest-key-bindings
1404 (not executing-kbd-macro) 1406 (not executing-kbd-macro)