aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJohn Wiegley2016-01-11 22:51:27 -0800
committerJohn Wiegley2016-01-11 22:51:27 -0800
commitc7bef6a4f033fa6b22906de0be6da54958d5b3c3 (patch)
tree3a0f34b340ad01de290f068530c27f35aba83724 /lisp
parentf5d90b5fcf0251466055c7dbed6069c1850d802d (diff)
parent1f6898d0510cd15455f665c0f38451755a374243 (diff)
downloademacs-c7bef6a4f033fa6b22906de0be6da54958d5b3c3.tar.gz
emacs-c7bef6a4f033fa6b22906de0be6da54958d5b3c3.zip
Merge from origin/emacs-25
1f6898d test/automated/vc-hg.el: Support out-of-tree build 3adb56e Minor change in tramp-tests.el 2b535ba ; * etc/NEWS: Update the js.el entry. 76b518c * etc/HELLO: Add Armenian and Mongolian greetings. b51f1ef Java Mode: Fontify identifiers in the presence of annotations. 36b9539 Avoid an infloop when we run out of memory 2006752 Avoid unnecessary failures of auto-saving after fatal error eef6784 Simplify HAVE_MODULES use in mark_maybe_pointer 552694a Revert attempt to use 'noexcept' in typedef 6ad0d39 Update documentation of 'indirect-function' c6a5314 ; * etc/NEWS: Move entry of 'inhibit-point-motion-hooks'. 303141a Update documentation for obsoleting 'syntax-begin-function' 4e6f61c ; * etc/NEWS: Mark documented and not-to-be-documented entries. e667bbb Document new features if Eshell 9c4e4e0 ; * etc/NEWS: Update EUDC entries. 1089dc9 Handle too long commands in Tramp 684eb58 * .gitattributes: *.cur and *.pif are binary files too. d2c7fda * src/alloc.c (mark_maybe_pointer): HAVE_MODULES may be undefined bd3f53d * sh-script.el (sh-smie-sh-rules): Improve indentation inside $(...) 09b2b8a * src/alloc.c (mark_maybe_pointer): Also check wide-int's emacs_value cca0f93 ; Account for spaces before the filename c71e1e8 Use short date for 'hg annotate', and output the author f50027b Spelling fix c7dff67 ; * etc/NEWS: Fix the Xref entries that got separated. cc140bc Document user-level functions in project.el f8208b6 Document the user-level features of the Xref package b131fb8 * loading.texi: Add `define-type' entry for load-history db3c2a8 Improve doc strings and prompts in xref.el f6117ef Allow the use of `font-lock-extend-region-multiline' in CC Mode. 90fd798 Fix coding system for Tramp on OS X. e985a0e ; * etc/NEWS: Mark the 'check-expensive' entry not to be documented. 9dfcbf0 Update 'load-history' docs 207e191 Fix (error ...) error 457738f Correctly analyze brace arguments in templated C++ function declarations. d57724a * lisp/cedet/mode-local.el (describe-function-orig-buffer): Declare. 2a9532d * lisp/ffap.el (ffap-latex-mode): Avoid free variable. 1a6b084 * lisp/play/dunnet.el (dun-fix-screen): Avoid `end-of-buffer`. 8be046f Respect fontification region calculated by major mode. Fixes bug #22316. 4b37cba Improve documentation of Delete Selection mode a034dd3 Fix two project-find-file issues 30abf29 Clarify doc string of 'dired-current-directory' e990bb2 Use the face of preceding text for displaying the ellipsis 5810ac3 Suppress Chinese file name test for OSX in tramp-tests.el eeb710a ; * lisp/startup.el: Sentences end with two spaces. 428b3de * admin/admin.el (set-version): Also handle the NEWS file. 648de81 ; Add NEWS entry for project.el 671862f apropos-library: Skip obvious duplicates; don't error on generics 51668a5 ; Grammar fix ed41d11 Add project-find-file and project-or-external-find-file 056da45 ; Improve commentary in 'setup_for_ellipsis' 269d008 ; Improve docstring for `inhibit-startup-echo-area-message'
Diffstat (limited to 'lisp')
-rw-r--r--lisp/apropos.el4
-rw-r--r--lisp/cedet/mode-local.el3
-rw-r--r--lisp/delsel.el36
-rw-r--r--lisp/dired.el4
-rw-r--r--lisp/ffap.el8
-rw-r--r--lisp/font-lock.el13
-rw-r--r--lisp/minibuffer.el3
-rw-r--r--lisp/net/tramp-compat.el2
-rw-r--r--lisp/net/tramp-sh.el230
-rw-r--r--lisp/play/dunnet.el2
-rw-r--r--lisp/progmodes/cc-defs.el46
-rw-r--r--lisp/progmodes/cc-engine.el40
-rw-r--r--lisp/progmodes/cc-fonts.el11
-rw-r--r--lisp/progmodes/cc-langs.el13
-rw-r--r--lisp/progmodes/cc-mode.el11
-rw-r--r--lisp/progmodes/project.el67
-rw-r--r--lisp/progmodes/sh-script.el6
-rw-r--r--lisp/progmodes/xref.el65
-rw-r--r--lisp/startup.el21
-rw-r--r--lisp/vc/add-log.el12
-rw-r--r--lisp/vc/vc-hg.el36
21 files changed, 401 insertions, 232 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 36a729a34ab..3c1a4136fbf 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -676,6 +676,10 @@ the output includes key-bindings of commands."
676 ;; (autoload (push (cdr x) autoloads)) 676 ;; (autoload (push (cdr x) autoloads))
677 (`require (push (cdr x) requires)) 677 (`require (push (cdr x) requires))
678 (`provide (push (cdr x) provides)) 678 (`provide (push (cdr x) provides))
679 (`t nil) ; Skip "was an autoload" entries.
680 ;; FIXME: Print information about each individual method: both
681 ;; its docstring and specializers (bug#21422).
682 (`cl-defmethod (push (cadr x) provides))
679 (_ (push (or (cdr-safe x) x) symbols)))) 683 (_ (push (or (cdr-safe x) x) symbols))))
680 (let ((apropos-pattern "")) ;Dummy binding for apropos-symbols-internal. 684 (let ((apropos-pattern "")) ;Dummy binding for apropos-symbols-internal.
681 (apropos-symbols-internal 685 (apropos-symbols-internal
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index c2b7cf50ac1..30320b00946 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -633,6 +633,9 @@ SYMBOL is a function that can be overridden."
633 ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE 633 ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
634 ))) 634 )))
635 635
636;; We are called from describe-function in help-fns.el, where this is defined.
637(defvar describe-function-orig-buffer)
638
636(defun describe-mode-local-overload (symbol) 639(defun describe-mode-local-overload (symbol)
637 "For `help-fns-describe-function-functions'; add overloads for SYMBOL." 640 "For `help-fns-describe-function-functions'; add overloads for SYMBOL."
638 (when (get symbol 'mode-local-overload) 641 (when (get symbol 'mode-local-overload)
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 46eea973a70..6a819ebbf67 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -37,16 +37,26 @@
37;; the values: 37;; the values:
38;; `yank' 38;; `yank'
39;; For commands which do a yank; ensures the region about to be 39;; For commands which do a yank; ensures the region about to be
40;; deleted isn't yanked. 40;; deleted isn't immediately yanked back, which would make the
41;; command a no-op.
41;; `supersede' 42;; `supersede'
42;; Delete the active region and ignore the current command, 43;; Delete the active region and ignore the current command,
43;; i.e. the command will just delete the region. 44;; i.e. the command will just delete the region. This is for
45;; commands that normally delete small amounts of text, like
46;; a single character -- they will instead delete the whole
47;; active region.
48;; `kill'
49;; `kill-region' is used on the selection, rather than
50;; `delete-region'. (Text selected with the mouse will typically
51;; be yankable anyhow.)
44;; t 52;; t
45;; The normal case: delete the active region prior to executing 53;; The normal case: delete the active region prior to executing
46;; the command which will insert replacement text. 54;; the command which will insert replacement text.
47;; <function> 55;; FUNCTION
48;; For commands which need to dynamically determine this behavior. 56;; For commands which need to dynamically determine this behavior.
49;; The function should return one of the above values or nil. 57;; FUNCTION should take no argument and return one of the above
58;; values, or nil. In the latter case, FUNCTION should itself
59;; do with the active region whatever is appropriate."
50 60
51;;; Code: 61;;; Code:
52 62
@@ -66,7 +76,11 @@ enable the mode if ARG is omitted or nil.
66 76
67When Delete Selection mode is enabled, typed text replaces the selection 77When Delete Selection mode is enabled, typed text replaces the selection
68if the selection is active. Otherwise, typed text is just inserted at 78if the selection is active. Otherwise, typed text is just inserted at
69point regardless of any selection." 79point regardless of any selection. Also, commands that normally delete
80just one character will delete the entire selection instead.
81
82See `delete-selection-helper' and `delete-selection-pre-hook' for
83information on adapting behavior of commands in Delete Selection mode."
70 :global t :group 'editing-basics 84 :global t :group 'editing-basics
71 (if (not delete-selection-mode) 85 (if (not delete-selection-mode)
72 (remove-hook 'pre-command-hook 'delete-selection-pre-hook) 86 (remove-hook 'pre-command-hook 'delete-selection-pre-hook)
@@ -147,10 +161,14 @@ With ARG, repeat that many times. `C-u' means until end of buffer."
147 "Delete selection according to TYPE: 161 "Delete selection according to TYPE:
148 `yank' 162 `yank'
149 For commands which do a yank; ensures the region about to be 163 For commands which do a yank; ensures the region about to be
150 deleted isn't yanked. 164 deleted isn't immediately yanked back, which would make the
165 command a no-op.
151 `supersede' 166 `supersede'
152 Delete the active region and ignore the current command, 167 Delete the active region and ignore the current command,
153 i.e. the command will just delete the region. 168 i.e. the command will just delete the region. This is for
169 commands that normally delete small amounts of text, like
170 a single character -- they will instead delete the whole
171 active region.
154 `kill' 172 `kill'
155 `kill-region' is used on the selection, rather than 173 `kill-region' is used on the selection, rather than
156 `delete-region'. (Text selected with the mouse will typically 174 `delete-region'. (Text selected with the mouse will typically
@@ -160,7 +178,9 @@ With ARG, repeat that many times. `C-u' means until end of buffer."
160 the command which will insert replacement text. 178 the command which will insert replacement text.
161 FUNCTION 179 FUNCTION
162 For commands which need to dynamically determine this behavior. 180 For commands which need to dynamically determine this behavior.
163 FUNCTION should take no argument and return one of the above values or nil." 181 FUNCTION should take no argument and return one of the above
182 values, or nil. In the latter case, FUNCTION should itself
183 do with the active region whatever is appropriate."
164 (condition-case data 184 (condition-case data
165 (cond ((eq type 'kill) ;Deprecated, backward compatibility. 185 (cond ((eq type 'kill) ;Deprecated, backward compatibility.
166 (delete-active-region t) 186 (delete-active-region t)
diff --git a/lisp/dired.el b/lisp/dired.el
index 52386c91198..63124fce5e5 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2810,7 +2810,9 @@ It runs the hook `dired-initial-position-hook'."
2810(defun dired-current-directory (&optional localp) 2810(defun dired-current-directory (&optional localp)
2811 "Return the name of the subdirectory to which this line belongs. 2811 "Return the name of the subdirectory to which this line belongs.
2812This returns a string with trailing slash, like `default-directory'. 2812This returns a string with trailing slash, like `default-directory'.
2813Optional argument means return a file name relative to `default-directory'." 2813Optional argument means return a file name relative to `default-directory',
2814in which case the value could be an empty string if `default-directory'
2815is the directory where the file on this line resides."
2814 (let ((here (point)) 2816 (let ((here (point))
2815 (alist (or dired-subdir-alist 2817 (alist (or dired-subdir-alist
2816 ;; probably because called in a non-dired buffer 2818 ;; probably because called in a non-dired buffer
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 6c7932b512e..abf979f6129 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -974,14 +974,14 @@ out of NAME."
974 (push (cons "" (cdr (assoc (match-string 0) ; i.e. "(TeX-current-macro)" 974 (push (cons "" (cdr (assoc (match-string 0) ; i.e. "(TeX-current-macro)"
975 preferred-suffix-rules))) 975 preferred-suffix-rules)))
976 guess-rules)) 976 guess-rules))
977 (setq kpsewhich-args (mapcar (lambda (rule)
978 (concat (car rule) name (cdr rule)))
979 guess-rules))
980 (with-temp-buffer 977 (with-temp-buffer
981 (let ((process-environment (buffer-local-value 978 (let ((process-environment (buffer-local-value
982 'process-environment curbuf)) 979 'process-environment curbuf))
983 (exec-path (buffer-local-value 'exec-path curbuf))) 980 (exec-path (buffer-local-value 'exec-path curbuf)))
984 (apply #'call-process "kpsewhich" nil t nil kpsewhich-args)) 981 (apply #'call-process "kpsewhich" nil t nil
982 (mapcar (lambda (rule)
983 (concat (car rule) name (cdr rule)))
984 guess-rules)))
985 (when (< (point-min) (point-max)) 985 (when (< (point-min) (point-max))
986 (buffer-substring (goto-char (point-min)) (point-at-eol)))))))) 986 (buffer-substring (goto-char (point-min)) (point-at-eol))))))))
987 987
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 4a92069b12e..3c1f01d5886 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1302,15 +1302,18 @@ This function does 2 things:
1302 (point-min)))) 1302 (point-min))))
1303 (when (< end (point-max)) 1303 (when (< end (point-max))
1304 (setq end 1304 (setq end
1305 (if (get-text-property end 'font-lock-multiline) 1305 (cond
1306 (or (text-property-any end (point-max) 1306 ((get-text-property end 'font-lock-multiline)
1307 'font-lock-multiline nil) 1307 (or (text-property-any end (point-max)
1308 (point-max)) 1308 'font-lock-multiline nil)
1309 (point-max)))
1310 ;; If `end' has been set by the function above, don't corrupt it.
1311 (font-lock-extend-after-change-region-function end)
1309 ;; Rounding up to a whole number of lines should include the 1312 ;; Rounding up to a whole number of lines should include the
1310 ;; line right after `end'. Typical case: the first char of 1313 ;; line right after `end'. Typical case: the first char of
1311 ;; the line was deleted. Or a \n was inserted in the middle 1314 ;; the line was deleted. Or a \n was inserted in the middle
1312 ;; of a line. 1315 ;; of a line.
1313 (1+ end)))) 1316 (t (1+ end)))))
1314 ;; Finally, pre-enlarge the region to a whole number of lines, to try 1317 ;; Finally, pre-enlarge the region to a whole number of lines, to try
1315 ;; and anticipate what font-lock-default-fontify-region will do, so as to 1318 ;; and anticipate what font-lock-default-fontify-region will do, so as to
1316 ;; avoid double-redisplay. 1319 ;; avoid double-redisplay.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 1251a4e1107..ecac0aeb135 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -831,7 +831,8 @@ styles for specific categories, such as files, buffers, etc."
831 831
832(defvar completion-category-defaults 832(defvar completion-category-defaults
833 '((buffer (styles . (basic substring))) 833 '((buffer (styles . (basic substring)))
834 (unicode-name (styles . (basic substring)))) 834 (unicode-name (styles . (basic substring)))
835 (project-file (styles . (basic substring))))
835 "Default settings for specific completion categories. 836 "Default settings for specific completion categories.
836Each entry has the shape (CATEGORY . ALIST) where ALIST is 837Each entry has the shape (CATEGORY . ALIST) where ALIST is
837an association list that can specify properties such as: 838an association list that can specify properties such as:
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index c6de1837e9a..44923aee895 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -56,6 +56,8 @@
56 (require 'custom) 56 (require 'custom)
57 (require 'format-spec) 57 (require 'format-spec)
58 (require 'shell) 58 (require 'shell)
59 ;; Introduced in Emacs 23.2.
60 (require 'ucs-normalize nil 'noerror)
59 61
60 (require 'trampver) 62 (require 'trampver)
61 (require 'tramp-loaddefs) 63 (require 'tramp-loaddefs)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ca0707f5941..7ace8864f88 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1100,15 +1100,19 @@ target of the symlink differ."
1100 ;; Right, they are on the same host, regardless of user, method, 1100 ;; Right, they are on the same host, regardless of user, method,
1101 ;; etc. We now make the link on the remote machine. This will 1101 ;; etc. We now make the link on the remote machine. This will
1102 ;; occur as the user that FILENAME belongs to. 1102 ;; occur as the user that FILENAME belongs to.
1103 (tramp-send-command-and-check 1103 (and (tramp-send-command-and-check
1104 l 1104 l (format "cd %s" (tramp-shell-quote-argument cwd)))
1105 (format 1105 (tramp-send-command-and-check
1106 "cd %s && %s -sf %s %s" 1106 l (format
1107 (tramp-shell-quote-argument cwd) 1107 "%s -sf %s %s"
1108 ln 1108 ln
1109 (tramp-shell-quote-argument filename) 1109 (tramp-shell-quote-argument filename)
1110 (tramp-shell-quote-argument l-localname)) 1110 ;; The command could exceed PATH_MAX, so we use
1111 t)))) 1111 ;; relative file names. However, relative file names
1112 ;; could start with "-". `tramp-shell-quote-argument'
1113 ;; does not handle this, we must do it ourselves.
1114 (tramp-shell-quote-argument
1115 (concat "./" (file-name-nondirectory l-localname)))))))))
1112 1116
1113(defun tramp-sh-handle-file-truename (filename) 1117(defun tramp-sh-handle-file-truename (filename)
1114 "Like `file-truename' for Tramp files." 1118 "Like `file-truename' for Tramp files."
@@ -1266,100 +1270,108 @@ target of the symlink differ."
1266 res-inode res-filemodes res-numlinks 1270 res-inode res-filemodes res-numlinks
1267 res-uid res-gid res-size res-symlink-target) 1271 res-uid res-gid res-size res-symlink-target)
1268 (tramp-message vec 5 "file attributes with ls: %s" localname) 1272 (tramp-message vec 5 "file attributes with ls: %s" localname)
1269 (tramp-send-command 1273 ;; We cannot send all three commands combined, it could exceed
1270 vec 1274 ;; NAME_MAX or PATH_MAX. Happened on Mac OS X, for example.
1271 (format "(%s %s || %s -h %s) && %s %s %s %s" 1275 (when (or (tramp-send-command-and-check
1272 (tramp-get-file-exists-command vec) 1276 vec
1273 (tramp-shell-quote-argument localname) 1277 (format "%s %s"
1274 (tramp-get-test-command vec) 1278 (tramp-get-file-exists-command vec)
1275 (tramp-shell-quote-argument localname) 1279 (tramp-shell-quote-argument localname)))
1276 (tramp-get-ls-command vec) 1280 (tramp-send-command-and-check
1277 (if (eq id-format 'integer) "-ildn" "-ild") 1281 vec
1278 ;; On systems which have no quoting style, file names 1282 (format "%s -h %s"
1279 ;; with special characters could fail. 1283 (tramp-get-test-command vec)
1280 (cond 1284 (tramp-shell-quote-argument localname))))
1281 ((tramp-get-ls-command-with-quoting-style vec) 1285 (tramp-send-command
1282 "--quoting-style=c") 1286 vec
1283 ((tramp-get-ls-command-with-w-option vec) 1287 (format "%s %s %s %s"
1284 "-w") 1288 (tramp-get-ls-command vec)
1285 (t "")) 1289 (if (eq id-format 'integer) "-ildn" "-ild")
1286 (tramp-shell-quote-argument localname))) 1290 ;; On systems which have no quoting style, file names
1287 ;; Parse `ls -l' output ... 1291 ;; with special characters could fail.
1288 (with-current-buffer (tramp-get-buffer vec) 1292 (cond
1289 (when (> (buffer-size) 0) 1293 ((tramp-get-ls-command-with-quoting-style vec)
1290 (goto-char (point-min)) 1294 "--quoting-style=c")
1291 ;; ... inode 1295 ((tramp-get-ls-command-with-w-option vec)
1292 (setq res-inode 1296 "-w")
1293 (condition-case err 1297 (t ""))
1294 (read (current-buffer)) 1298 (tramp-shell-quote-argument localname)))
1295 (invalid-read-syntax 1299 ;; Parse `ls -l' output ...
1296 (when (and (equal (cadr err) 1300 (with-current-buffer (tramp-get-buffer vec)
1297 "Integer constant overflow in reader") 1301 (when (> (buffer-size) 0)
1298 (string-match 1302 (goto-char (point-min))
1299 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'" 1303 ;; ... inode
1300 (car (cddr err)))) 1304 (setq res-inode
1301 (let* ((big (read (substring (car (cddr err)) 0 1305 (condition-case err
1302 (match-beginning 1)))) 1306 (read (current-buffer))
1303 (small (read (match-string 1 (car (cddr err))))) 1307 (invalid-read-syntax
1304 (twiddle (/ small 65536))) 1308 (when (and (equal (cadr err)
1305 (cons (+ big twiddle) 1309 "Integer constant overflow in reader")
1306 (- small (* twiddle 65536)))))))) 1310 (string-match
1307 ;; ... file mode flags 1311 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'"
1308 (setq res-filemodes (symbol-name (read (current-buffer)))) 1312 (car (cddr err))))
1309 ;; ... number links 1313 (let* ((big (read (substring (car (cddr err)) 0
1310 (setq res-numlinks (read (current-buffer))) 1314 (match-beginning 1))))
1311 ;; ... uid and gid 1315 (small (read (match-string 1 (car (cddr err)))))
1312 (setq res-uid (read (current-buffer))) 1316 (twiddle (/ small 65536)))
1313 (setq res-gid (read (current-buffer))) 1317 (cons (+ big twiddle)
1314 (if (eq id-format 'integer) 1318 (- small (* twiddle 65536))))))))
1319 ;; ... file mode flags
1320 (setq res-filemodes (symbol-name (read (current-buffer))))
1321 ;; ... number links
1322 (setq res-numlinks (read (current-buffer)))
1323 ;; ... uid and gid
1324 (setq res-uid (read (current-buffer)))
1325 (setq res-gid (read (current-buffer)))
1326 (if (eq id-format 'integer)
1327 (progn
1328 (unless (numberp res-uid) (setq res-uid -1))
1329 (unless (numberp res-gid) (setq res-gid -1)))
1315 (progn 1330 (progn
1316 (unless (numberp res-uid) (setq res-uid -1)) 1331 (unless (stringp res-uid) (setq res-uid (symbol-name res-uid)))
1317 (unless (numberp res-gid) (setq res-gid -1))) 1332 (unless (stringp res-gid) (setq res-gid (symbol-name res-gid)))))
1318 (progn 1333 ;; ... size
1319 (unless (stringp res-uid) (setq res-uid (symbol-name res-uid))) 1334 (setq res-size (read (current-buffer)))
1320 (unless (stringp res-gid) (setq res-gid (symbol-name res-gid))))) 1335 ;; From the file modes, figure out other stuff.
1321 ;; ... size 1336 (setq symlinkp (eq ?l (aref res-filemodes 0)))
1322 (setq res-size (read (current-buffer))) 1337 (setq dirp (eq ?d (aref res-filemodes 0)))
1323 ;; From the file modes, figure out other stuff. 1338 ;; If symlink, find out file name pointed to.
1324 (setq symlinkp (eq ?l (aref res-filemodes 0))) 1339 (when symlinkp
1325 (setq dirp (eq ?d (aref res-filemodes 0))) 1340 (search-forward "-> ")
1326 ;; If symlink, find out file name pointed to. 1341 (setq res-symlink-target
1327 (when symlinkp 1342 (if (tramp-get-ls-command-with-quoting-style vec)
1328 (search-forward "-> ") 1343 (read (current-buffer))
1329 (setq res-symlink-target 1344 (buffer-substring (point) (point-at-eol)))))
1330 (if (tramp-get-ls-command-with-quoting-style vec) 1345 ;; Return data gathered.
1331 (read (current-buffer)) 1346 (list
1332 (buffer-substring (point) (point-at-eol))))) 1347 ;; 0. t for directory, string (name linked to) for symbolic
1333 ;; Return data gathered. 1348 ;; link, or nil.
1334 (list 1349 (or dirp res-symlink-target)
1335 ;; 0. t for directory, string (name linked to) for symbolic 1350 ;; 1. Number of links to file.
1336 ;; link, or nil. 1351 res-numlinks
1337 (or dirp res-symlink-target) 1352 ;; 2. File uid.
1338 ;; 1. Number of links to file. 1353 res-uid
1339 res-numlinks 1354 ;; 3. File gid.
1340 ;; 2. File uid. 1355 res-gid
1341 res-uid 1356 ;; 4. Last access time, as a list of integers. Normally
1342 ;; 3. File gid. 1357 ;; this would be in the same format as `current-time', but
1343 res-gid 1358 ;; the subseconds part is not currently implemented, and (0
1344 ;; 4. Last access time, as a list of integers. Normally this 1359 ;; 0) denotes an unknown time.
1345 ;; would be in the same format as `current-time', but the 1360 ;; 5. Last modification time, likewise.
1346 ;; subseconds part is not currently implemented, and (0 0) 1361 ;; 6. Last status change time, likewise.
1347 ;; denotes an unknown time. 1362 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
1348 ;; 5. Last modification time, likewise. 1363 ;; 7. Size in bytes (-1, if number is out of range).
1349 ;; 6. Last status change time, likewise. 1364 res-size
1350 '(0 0) '(0 0) '(0 0) ;CCC how to find out? 1365 ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
1351 ;; 7. Size in bytes (-1, if number is out of range). 1366 res-filemodes
1352 res-size 1367 ;; 9. t if file's gid would change if file were deleted and
1353 ;; 8. File modes, as a string of ten letters or dashes as in ls -l. 1368 ;; recreated. Will be set in `tramp-convert-file-attributes'.
1354 res-filemodes 1369 t
1355 ;; 9. t if file's gid would change if file were deleted and 1370 ;; 10. Inode number.
1356 ;; recreated. Will be set in `tramp-convert-file-attributes'. 1371 res-inode
1357 t 1372 ;; 11. Device number. Will be replaced by a virtual device number.
1358 ;; 10. Inode number. 1373 -1
1359 res-inode 1374 ))))))
1360 ;; 11. Device number. Will be replaced by a virtual device number.
1361 -1
1362 )))))
1363 1375
1364(defun tramp-do-file-attributes-with-perl 1376(defun tramp-do-file-attributes-with-perl
1365 (vec localname &optional id-format) 1377 (vec localname &optional id-format)
@@ -4214,10 +4226,8 @@ process to set up. VEC specifies the connection."
4214 (cons 'undecided 'undecided))) 4226 (cons 'undecided 'undecided)))
4215 cs-decode cs-encode) 4227 cs-decode cs-encode)
4216 (when (symbolp cs) (setq cs (cons cs cs))) 4228 (when (symbolp cs) (setq cs (cons cs cs)))
4217 (setq cs-decode (car cs)) 4229 (setq cs-decode (or (car cs) 'undecided)
4218 (setq cs-encode (cdr cs)) 4230 cs-encode (or (cdr cs) 'undecided))
4219 (unless cs-decode (setq cs-decode 'undecided))
4220 (unless cs-encode (setq cs-encode 'undecided))
4221 (setq cs-encode 4231 (setq cs-encode
4222 (tramp-compat-coding-system-change-eol-conversion 4232 (tramp-compat-coding-system-change-eol-conversion
4223 cs-encode 4233 cs-encode
@@ -4229,7 +4239,13 @@ process to set up. VEC specifies the connection."
4229 (when (search-forward "\r" nil t) 4239 (when (search-forward "\r" nil t)
4230 (setq cs-decode (tramp-compat-coding-system-change-eol-conversion 4240 (setq cs-decode (tramp-compat-coding-system-change-eol-conversion
4231 cs-decode 'dos))) 4241 cs-decode 'dos)))
4232 (tramp-compat-funcall 4242 ;; Special setting for Mac OS X.
4243 (when (and (string-match
4244 "^Darwin" (tramp-get-connection-property vec "uname" ""))
4245 (memq 'utf-8-hfs (coding-system-list)))
4246 (setq cs-decode 'utf-8-hfs
4247 cs-encode 'utf-8-hfs))
4248 (tramp-compat-funcall
4233 'set-buffer-process-coding-system cs-decode cs-encode) 4249 'set-buffer-process-coding-system cs-decode cs-encode)
4234 (tramp-message 4250 (tramp-message
4235 vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) 4251 vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 941f98ebb69..8ed0bb3bbb4 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -1203,7 +1203,7 @@ for a moment, then straighten yourself up.
1203 (interactive) 1203 (interactive)
1204 (forward-line (- 0 (- (window-height) 2 ))) 1204 (forward-line (- 0 (- (window-height) 2 )))
1205 (set-window-start (selected-window) (point)) 1205 (set-window-start (selected-window) (point))
1206 (end-of-buffer)) 1206 (goto-char (point-max)))
1207 1207
1208;;; Insert something into the buffer, followed by newline. 1208;;; Insert something into the buffer, followed by newline.
1209 1209
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index c42fbe7e51f..2056f3907b8 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -656,23 +656,35 @@ right side of it."
656;; Wrappers for common scan-lists cases, mainly because it's almost 656;; Wrappers for common scan-lists cases, mainly because it's almost
657;; impossible to get a feel for how that function works. 657;; impossible to get a feel for how that function works.
658 658
659(defmacro c-go-list-forward () 659(defmacro c-go-list-forward (&optional pos limit)
660 "Move backward across one balanced group of parentheses. 660 "Move forward across one balanced group of parentheses starting at POS or
661 661point. Return POINT when we succeed, NIL when we fail. In the latter case,
662Return POINT when we succeed, NIL when we fail. In the latter case, leave 662leave point unmoved.
663point unmoved." 663
664 `(c-safe (let ((endpos (scan-lists (point) 1 0))) 664A LIMIT for the search may be given. The start position is assumed to be
665 (goto-char endpos) 665before it."
666 endpos))) 666 (let ((res `(c-safe (goto-char (scan-lists ,(or pos `(point)) 1 0)) (point))))
667 667 (if limit
668(defmacro c-go-list-backward () 668 `(save-restriction
669 "Move backward across one balanced group of parentheses. 669 (if ,limit
670 670 (narrow-to-region (point-min) ,limit))
671Return POINT when we succeed, NIL when we fail. In the latter case, leave 671 ,res)
672point unmoved." 672 res)))
673 `(c-safe (let ((endpos (scan-lists (point) -1 0))) 673
674 (goto-char endpos) 674(defmacro c-go-list-backward (&optional pos limit)
675 endpos))) 675 "Move backward across one balanced group of parentheses starting at POS or
676point. Return POINT when we succeed, NIL when we fail. In the latter case,
677leave point unmoved.
678
679A LIMIT for the search may be given. The start position is assumed to be
680after it."
681 (let ((res `(c-safe (goto-char (scan-lists ,(or pos `(point)) -1 0)) (point))))
682 (if limit
683 `(save-restriction
684 (if ,limit
685 (narrow-to-region ,limit (point-max)))
686 ,res)
687 res)))
676 688
677(defmacro c-up-list-forward (&optional pos limit) 689(defmacro c-up-list-forward (&optional pos limit)
678 "Return the first position after the list sexp containing POS, 690 "Return the first position after the list sexp containing POS,
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 3301d415923..b08c555e34f 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -5688,8 +5688,8 @@ comment at the start of cc-engine.el for more info."
5688 (c-backward-token-2) 5688 (c-backward-token-2)
5689 (setq c-restricted-<>-arglists 5689 (setq c-restricted-<>-arglists
5690 (and (not (looking-at c-opt-<>-sexp-key)) 5690 (and (not (looking-at c-opt-<>-sexp-key))
5691 (progn (c-backward-syntactic-ws) ; to < or , 5691 (progn (c-backward-syntactic-ws) ; to ( or ,
5692 (and (memq (char-before) '(?< ?,)) 5692 (and (memq (char-before) '(?\( ?,)) ; what about <?
5693 (not (eq (c-get-char-property (point) 'c-type) 5693 (not (eq (c-get-char-property (point) 'c-type)
5694 'c-decl-arg-start))))))) 5694 'c-decl-arg-start)))))))
5695 (or (c-forward-<>-arglist nil) 5695 (or (c-forward-<>-arglist nil)
@@ -6641,16 +6641,22 @@ comment at the start of cc-engine.el for more info."
6641 res)) 6641 res))
6642 6642
6643(defun c-forward-annotation () 6643(defun c-forward-annotation ()
6644 ;; Used for Java code only at the moment. Assumes point is on the 6644 ;; Used for Java code only at the moment. Assumes point is on the @, moves
6645 ;; @, moves forward an annotation. returns nil if there is no 6645 ;; forward an annotation and returns t. Leaves point unmoved and returns
6646 ;; annotation at point. 6646 ;; nil if there is no annotation at point.
6647 (and (looking-at "@") 6647 (let ((pos (point)))
6648 (progn (forward-char) t) 6648 (or
6649 (c-forward-type) 6649 (and (looking-at "@")
6650 (progn (c-forward-syntactic-ws) t) 6650 (not (looking-at c-keywords-regexp))
6651 (if (looking-at "(") 6651 (progn (forward-char) t)
6652 (c-go-list-forward) 6652 (looking-at c-symbol-key)
6653 t))) 6653 (progn (goto-char (match-end 0))
6654 (c-forward-syntactic-ws)
6655 t)
6656 (if (looking-at "(")
6657 (c-go-list-forward)
6658 t))
6659 (progn (goto-char pos) nil))))
6654 6660
6655(defmacro c-pull-open-brace (ps) 6661(defmacro c-pull-open-brace (ps)
6656 ;; Pull the next open brace from PS (which has the form of paren-state), 6662 ;; Pull the next open brace from PS (which has the form of paren-state),
@@ -6959,9 +6965,8 @@ comment at the start of cc-engine.el for more info."
6959 (when (or (looking-at c-prefix-spec-kwds-re) ;FIXME!!! includes auto 6965 (when (or (looking-at c-prefix-spec-kwds-re) ;FIXME!!! includes auto
6960 (and (c-major-mode-is 'java-mode) 6966 (and (c-major-mode-is 'java-mode)
6961 (looking-at "@[A-Za-z0-9]+"))) 6967 (looking-at "@[A-Za-z0-9]+")))
6962 (save-match-data 6968 (if (save-match-data (looking-at c-typedef-key))
6963 (if (looking-at c-typedef-key) 6969 (setq at-typedef t))
6964 (setq at-typedef t)))
6965 (setq kwd-sym (c-keyword-sym (match-string 1))) 6970 (setq kwd-sym (c-keyword-sym (match-string 1)))
6966 (save-excursion 6971 (save-excursion
6967 (c-forward-keyword-clause 1) 6972 (c-forward-keyword-clause 1)
@@ -9106,6 +9111,11 @@ comment at the start of cc-engine.el for more info."
9106 (goto-char containing-sexp) 9111 (goto-char containing-sexp)
9107 (if (or (save-excursion 9112 (if (or (save-excursion
9108 (c-backward-syntactic-ws lim) 9113 (c-backward-syntactic-ws lim)
9114 (while (and (eq (char-before) ?>)
9115 (c-get-char-property (1- (point))
9116 'syntax-table)
9117 (c-go-list-backward nil lim))
9118 (c-backward-syntactic-ws lim))
9109 (and (> (point) (or lim (point-min))) 9119 (and (> (point) (or lim (point-min)))
9110 (c-on-identifier))) 9120 (c-on-identifier)))
9111 (and c-special-brace-lists 9121 (and c-special-brace-lists
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index f74e5cbf678..03e67a99515 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1157,15 +1157,6 @@ casts and declarations are fontified. Used on level 2 and higher."
1157 (setq pos (point)))))) ; acts to make the `while' form continue. 1157 (setq pos (point)))))) ; acts to make the `while' form continue.
1158 nil) 1158 nil)
1159 1159
1160(defconst c-font-lock-maybe-decl-faces
1161 ;; List of faces that might be put at the start of a type when
1162 ;; `c-font-lock-declarations' runs. This needs to be evaluated to
1163 ;; ensure that face name aliases in Emacs are resolved.
1164 (list nil
1165 font-lock-type-face
1166 c-reference-face-name
1167 font-lock-keyword-face))
1168
1169(defun c-font-lock-declarations (limit) 1160(defun c-font-lock-declarations (limit)
1170 ;; Fontify all the declarations, casts and labels from the point to LIMIT. 1161 ;; Fontify all the declarations, casts and labels from the point to LIMIT.
1171 ;; Assumes that strings and comments have been fontified already. 1162 ;; Assumes that strings and comments have been fontified already.
@@ -1256,7 +1247,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1256 (c-find-decl-spots 1247 (c-find-decl-spots
1257 limit 1248 limit
1258 c-decl-start-re 1249 c-decl-start-re
1259 c-font-lock-maybe-decl-faces 1250 (eval c-maybe-decl-faces)
1260 1251
1261 (lambda (match-pos inside-macro) 1252 (lambda (match-pos inside-macro)
1262 ;; Note to maintainers: don't use `limit' inside this lambda form; 1253 ;; Note to maintainers: don't use `limit' inside this lambda form;
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 08d84fbb625..b52da3f662d 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3251,6 +3251,19 @@ way."
3251 objc t) 3251 objc t)
3252(c-lang-defvar c-type-decl-end-used (c-lang-const c-type-decl-end-used)) 3252(c-lang-defvar c-type-decl-end-used (c-lang-const c-type-decl-end-used))
3253 3253
3254(c-lang-defconst c-maybe-decl-faces
3255 "List of faces that might be put at the start of a type when
3256`c-font-lock-declarations' runs. This must be evaluated (with `eval') at
3257runtime to get the actual list of faces. This ensures that face name
3258aliases in Emacs are resolved."
3259 t '(list nil
3260 font-lock-type-face
3261 c-reference-face-name
3262 font-lock-keyword-face)
3263 java (append (c-lang-const c-maybe-decl-faces)
3264 '(font-lock-preprocessor-face)))
3265(c-lang-defvar c-maybe-decl-faces (c-lang-const c-maybe-decl-faces))
3266
3254 3267
3255;;; Wrap up the `c-lang-defvar' system. 3268;;; Wrap up the `c-lang-defvar' system.
3256 3269
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 644065911dd..738870b727a 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1336,12 +1336,13 @@ This function is called from `c-common-init', once per mode initialization."
1336 . c-mark-function))) 1336 . c-mark-function)))
1337 1337
1338 ;; Prevent `font-lock-default-fontify-region' extending the region it will 1338 ;; Prevent `font-lock-default-fontify-region' extending the region it will
1339 ;; fontify to whole lines by removing `font-lock-extend-region-whole-lines' 1339 ;; fontify to whole lines by removing `font-lock-extend-region-wholelines'
1340 ;; (and, coincidentally, `font-lock-extend-region-multiline' (which we do 1340 ;; from `font-lock-extend-region-functions'. (Emacs only). This fixes
1341 ;; not need)) from `font-lock-extend-region-functions'. (Emacs only). This 1341 ;; Emacs bug #19669.
1342 ;; fixes Emacs bug #19669.
1343 (when (boundp 'font-lock-extend-region-functions) 1342 (when (boundp 'font-lock-extend-region-functions)
1344 (setq font-lock-extend-region-functions nil)) 1343 (setq font-lock-extend-region-functions
1344 (delq 'font-lock-extend-region-wholelines
1345 font-lock-extend-region-functions)))
1345 1346
1346 (make-local-variable 'font-lock-fontify-region-function) 1347 (make-local-variable 'font-lock-fontify-region-function)
1347 (setq font-lock-fontify-region-function 'c-font-lock-fontify-region) 1348 (setq font-lock-fontify-region-function 'c-font-lock-fontify-region)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index d77158761eb..fe28ed776b2 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -27,6 +27,11 @@
27;; current project, without having to know which package handles 27;; current project, without having to know which package handles
28;; detection of that project type, parsing its config files, etc. 28;; detection of that project type, parsing its config files, etc.
29;; 29;;
30;; NOTE: The project API is still experimental and can change in major,
31;; backward-incompatible ways. Everyone is encouraged to try it, and
32;; report to us any problems or use cases we hadn't anticipated, by
33;; sending an email to emacs-devel, or `M-x report-emacs-bug'.
34;;
30;; Infrastructure: 35;; Infrastructure:
31;; 36;;
32;; Function `project-current', to determine the current project 37;; Function `project-current', to determine the current project
@@ -45,10 +50,12 @@
45 50
46;;; TODO: 51;;; TODO:
47 52
48;; * Commands `project-find-file' and `project-or-external-find-file'. 53;; * Reliably cache the list of files in the project, probably using
49;; Currently blocked on adding a new completion style that would let 54;; filenotify.el (if supported) to invalidate. And avoiding caching
50;; the user enter just the base file name (or a part of it), and get 55;; if it's not available (manual cache invalidation is not nice).
51;; it expanded to the absolute file name. 56;;
57;; * Allow the backend to override the file-listing logic? Maybe also
58;; to delegate file name completion to an external tool.
52;; 59;;
53;; * Build tool related functionality. Start with a `project-build' 60;; * Build tool related functionality. Start with a `project-build'
54;; command, which should provide completions on tasks to run, and 61;; command, which should provide completions on tasks to run, and
@@ -251,13 +258,15 @@ DIRS must contain directory names."
251(defun project--value-in-dir (var dir) 258(defun project--value-in-dir (var dir)
252 (with-temp-buffer 259 (with-temp-buffer
253 (setq default-directory dir) 260 (setq default-directory dir)
254 (hack-dir-local-variables-non-file-buffer) 261 (let ((enable-local-variables :all))
262 (hack-dir-local-variables-non-file-buffer))
255 (symbol-value var))) 263 (symbol-value var)))
256 264
257(declare-function grep-read-files "grep") 265(declare-function grep-read-files "grep")
258(declare-function xref-collect-matches "xref") 266(declare-function xref-collect-matches "xref")
259(declare-function xref--show-xrefs "xref") 267(declare-function xref--show-xrefs "xref")
260(declare-function xref-backend-identifier-at-point "xref") 268(declare-function xref-backend-identifier-at-point "xref")
269(declare-function xref--find-ignores-arguments "xref")
261 270
262;;;###autoload 271;;;###autoload
263(defun project-find-regexp (regexp) 272(defun project-find-regexp (regexp)
@@ -302,5 +311,53 @@ pattern to search for."
302 (user-error "No matches for: %s" regexp)) 311 (user-error "No matches for: %s" regexp))
303 (xref--show-xrefs xrefs nil))) 312 (xref--show-xrefs xrefs nil)))
304 313
314;;;###autoload
315(defun project-find-file ()
316 "Visit a file in the current project's roots.
317
318This is like `find-file', but it limits the file-name completion
319candidates to the files within the current project roots."
320 (interactive)
321 (let* ((pr (project-current t))
322 (dirs (project-roots pr)))
323 (project--find-file-in dirs pr)))
324
325;;;###autoload
326(defun project-or-external-find-file ()
327 "Visit a file in the current project's roots or external roots.
328
329This is like `find-file', but it limits the file-name completion
330candidates to the files within the current project roots and external roots."
331 (interactive)
332 (let* ((pr (project-current t))
333 (dirs (append
334 (project-roots pr)
335 (project-external-roots pr))))
336 (project--find-file-in dirs pr)))
337
338;; FIXME: Uniquely abbreviate the roots?
339(defun project--find-file-in (dirs project)
340 (require 'xref)
341 (let* ((all-files
342 (cl-mapcan
343 (lambda (dir)
344 (let ((command
345 (format "%s %s %s -type f -print0"
346 find-program
347 dir
348 (xref--find-ignores-arguments
349 (project-ignores project dir)
350 (expand-file-name dir)))))
351 (split-string (shell-command-to-string command) "\0" t)))
352 dirs))
353 (table (lambda (string pred action)
354 (cond
355 ((eq action 'metadata)
356 '(metadata . ((category . project-file))))
357 (t
358 (complete-with-action action all-files string pred))))))
359 (find-file
360 (completing-read "Find file: " table nil t))))
361
305(provide 'project) 362(provide 'project)
306;;; project.el ends here 363;;; project.el ends here
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 02d329d794d..7f89ab2762c 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2115,7 +2115,11 @@ May return nil if the line should not be treated as continued."
2115 ;; sh-indent-after-done: aligned completely differently. 2115 ;; sh-indent-after-done: aligned completely differently.
2116 (`(:after . "in") (sh-var-value 'sh-indent-for-case-label)) 2116 (`(:after . "in") (sh-var-value 'sh-indent-for-case-label))
2117 ;; sh-indent-for-continuation: Line continuations are handled differently. 2117 ;; sh-indent-for-continuation: Line continuations are handled differently.
2118 (`(:after . ,(or `"(" `"{" `"[")) (sh-var-value 'sh-indent-after-open)) 2118 (`(:after . ,(or `"(" `"{" `"["))
2119 (if (not (looking-at ".[ \t]*[^\n \t#]"))
2120 (sh-var-value 'sh-indent-after-open)
2121 (goto-char (1- (match-end 0)))
2122 `(column . ,(current-column))))
2119 ;; sh-indent-after-function: we don't handle it differently. 2123 ;; sh-indent-after-function: we don't handle it differently.
2120 )) 2124 ))
2121 2125
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index ae5ec61520d..fe39122d24f 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -208,7 +208,7 @@ LENGTH is the match length, in characters."
208 208
209(defvar xref-backend-functions nil 209(defvar xref-backend-functions nil
210 "Special hook to find the xref backend for the current context. 210 "Special hook to find the xref backend for the current context.
211Each functions on this hook is called in turn with no arguments 211Each function on this hook is called in turn with no arguments,
212and should return either nil to mean that it is not applicable, 212and should return either nil to mean that it is not applicable,
213or an xref backend, which is a value to be used to dispatch the 213or an xref backend, which is a value to be used to dispatch the
214generic functions.") 214generic functions.")
@@ -502,10 +502,14 @@ WINDOW controls how the buffer is displayed:
502 (xref--pop-to-location xref window))) 502 (xref--pop-to-location xref window)))
503 503
504(defun xref-query-replace (from to) 504(defun xref-query-replace (from to)
505 "Perform interactive replacement in all current matches." 505 "Perform interactive replacement of FROM with TO in all displayed xrefs.
506
507This command interactively replaces FROM with TO in the names of the
508references displayed in the current *xref* buffer."
506 (interactive 509 (interactive
507 (list (read-regexp "Query replace regexp in matches" ".*") 510 (let ((fr (read-regexp "Xref query-replace (regexp)" ".*")))
508 (read-regexp "Replace with: "))) 511 (list fr
512 (read-regexp (format "Xref query-replace (regexp) %s with: " fr)))))
509 (let (pairs item) 513 (let (pairs item)
510 (unwind-protect 514 (unwind-protect
511 (progn 515 (progn
@@ -762,12 +766,10 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
762With prefix argument or when there's no identifier at point, 766With prefix argument or when there's no identifier at point,
763prompt for it. 767prompt for it.
764 768
765If the backend has sufficient information to determine a unique 769If sufficient information is available to determine a unique
766definition for IDENTIFIER, it returns only that definition. If 770definition for IDENTIFIER, display it in the selected window.
767there are multiple possible definitions, it returns all of them. 771Otherwise, display the list of the possible definitions in a
768 772buffer where the user can select from the list."
769If the backend returns one definition, jump to it; otherwise,
770display the list in a buffer."
771 (interactive (list (xref--read-identifier "Find definitions of: "))) 773 (interactive (list (xref--read-identifier "Find definitions of: ")))
772 (xref--find-definitions identifier nil)) 774 (xref--find-definitions identifier nil))
773 775
@@ -876,7 +878,9 @@ IGNORES is a list of glob patterns."
876 grep-find-template t t)) 878 grep-find-template t t))
877 (grep-highlight-matches nil) 879 (grep-highlight-matches nil)
878 (command (xref--rgrep-command (xref--regexp-to-extended regexp) 880 (command (xref--rgrep-command (xref--regexp-to-extended regexp)
879 files dir ignores)) 881 files
882 (expand-file-name dir)
883 ignores))
880 (orig-buffers (buffer-list)) 884 (orig-buffers (buffer-list))
881 (buf (get-buffer-create " *xref-grep*")) 885 (buf (get-buffer-create " *xref-grep*"))
882 (grep-re (caar grep-regexp-alist)) 886 (grep-re (caar grep-regexp-alist))
@@ -912,23 +916,28 @@ IGNORES is a list of glob patterns."
912 " " 916 " "
913 (shell-quote-argument ")")) 917 (shell-quote-argument ")"))
914 dir 918 dir
915 (concat 919 (xref--find-ignores-arguments ignores dir)))
916 (shell-quote-argument "(") 920
917 " -path " 921(defun xref--find-ignores-arguments (ignores dir)
918 (mapconcat 922 ;; `shell-quote-argument' quotes the tilde as well.
919 (lambda (ignore) 923 (cl-assert (not (string-match-p "\\`~" dir)))
920 (when (string-match-p "/\\'" ignore) 924 (concat
921 (setq ignore (concat ignore "*"))) 925 (shell-quote-argument "(")
922 (if (string-match "\\`\\./" ignore) 926 " -path "
923 (setq ignore (replace-match dir t t ignore)) 927 (mapconcat
924 (unless (string-prefix-p "*" ignore) 928 (lambda (ignore)
925 (setq ignore (concat "*/" ignore)))) 929 (when (string-match-p "/\\'" ignore)
926 (shell-quote-argument ignore)) 930 (setq ignore (concat ignore "*")))
927 ignores 931 (if (string-match "\\`\\./" ignore)
928 " -o -path ") 932 (setq ignore (replace-match dir t t ignore))
929 " " 933 (unless (string-prefix-p "*" ignore)
930 (shell-quote-argument ")") 934 (setq ignore (concat "*/" ignore))))
931 " -prune -o "))) 935 (shell-quote-argument ignore))
936 ignores
937 " -o -path ")
938 " "
939 (shell-quote-argument ")")
940 " -prune -o "))
932 941
933(defun xref--regexp-to-extended (str) 942(defun xref--regexp-to-extended (str)
934 (replace-regexp-in-string 943 (replace-regexp-in-string
diff --git a/lisp/startup.el b/lisp/startup.el
index 61f6db74f2e..15a79f6f5bf 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -76,13 +76,24 @@ once you are familiar with the contents of the startup screen."
76 76
77(defvar startup-screen-inhibit-startup-screen nil) 77(defvar startup-screen-inhibit-startup-screen nil)
78 78
79;; FIXME? Why does this get such weirdly extreme treatment, when the 79;; The mechanism used to ensure that only end users can disable this
80;; more important inhibit-startup-screen does not. 80;; message is not complex. Clearly, it is possible for a determined
81;; system administrator to inhibit this message anyway, but at least
82;; they will do so with knowledge of why the Emacs developers think
83;; this is a bad idea.
81(defcustom inhibit-startup-echo-area-message nil 84(defcustom inhibit-startup-echo-area-message nil
82 "Non-nil inhibits the initial startup echo area message. 85 "Non-nil inhibits the initial startup echo area message.
83Setting this variable takes effect 86
84only if you do it with the customization buffer 87The startup message is in the echo area as it provides information
85or if your init file contains a line of this form: 88about GNU Emacs and the GNU system in general, which we want all
89users to see. As this is the least intrusive startup message,
90this variable gets specialized treatment to prevent the message
91from being disabled site-wide by systems administrators, while
92still allowing individual users to do so.
93
94Setting this variable takes effect only if you do it with the
95customization buffer or if your init file contains a line of this
96form:
86 (setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\") 97 (setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\")
87If your init file is byte-compiled, use the following form 98If your init file is byte-compiled, use the following form
88instead: 99instead:
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index a5fe9563afb..45e863340a5 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -481,9 +481,10 @@ try to visit the file for the change under `point' instead."
481 (apply 'change-log-goto-source-1 481 (apply 'change-log-goto-source-1
482 (append change-log-find-head change-log-find-tail)) 482 (append change-log-find-head change-log-find-tail))
483 (error 483 (error
484 "Cannot find more matches for tag `%s' in file `%s'" 484 (format-message
485 (car change-log-find-head) 485 "Cannot find more matches for tag `%s' in file `%s'"
486 (nth 2 change-log-find-head)))) 486 (car change-log-find-head)
487 (nth 2 change-log-find-head)))))
487 (save-excursion 488 (save-excursion
488 (let* ((at (point)) 489 (let* ((at (point))
489 (tag-at (change-log-search-tag-name)) 490 (tag-at (change-log-search-tag-name))
@@ -515,8 +516,9 @@ try to visit the file for the change under `point' instead."
515 (condition-case nil 516 (condition-case nil
516 (setq change-log-find-tail 517 (setq change-log-find-tail
517 (apply 'change-log-goto-source-1 change-log-find-head)) 518 (apply 'change-log-goto-source-1 change-log-find-head))
518 (error "Cannot find matches for tag `%s' in file `%s'" 519 (error
519 tag file)))))))) 520 (format-message "Cannot find matches for tag `%s' in file `%s'"
521 tag file)))))))))
520 522
521(defun change-log-next-error (&optional argp reset) 523(defun change-log-next-error (&optional argp reset)
522 "Move to the Nth (default 1) next match in a ChangeLog buffer. 524 "Move to the Nth (default 1) next match in a ChangeLog buffer.
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 8a0a9f91a48..8cb3547b13b 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -131,7 +131,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
131 :version "23.1" 131 :version "23.1"
132 :group 'vc-hg) 132 :group 'vc-hg)
133 133
134(defcustom vc-hg-annotate-switches nil 134(defcustom vc-hg-annotate-switches '("-u" "--follow")
135 "String or list of strings specifying switches for hg annotate under VC. 135 "String or list of strings specifying switches for hg annotate under VC.
136If nil, use the value of `vc-annotate-switches'. If t, use no 136If nil, use the value of `vc-annotate-switches'. If t, use no
137switches." 137switches."
@@ -380,36 +380,44 @@ If LIMIT is non-nil, show no more than this many entries."
380(defun vc-hg-annotate-command (file buffer &optional revision) 380(defun vc-hg-annotate-command (file buffer &optional revision)
381 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. 381 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
382Optional arg REVISION is a revision to annotate from." 382Optional arg REVISION is a revision to annotate from."
383 (apply #'vc-hg-command buffer 0 file "annotate" "-d" "-n" "--follow" 383 (apply #'vc-hg-command buffer 0 file "annotate" "-dq" "-n"
384 (append (vc-switches 'hg 'annotate) 384 (append (vc-switches 'hg 'annotate)
385 (if revision (list (concat "-r" revision)))))) 385 (if revision (list (concat "-r" revision))))))
386 386
387(declare-function vc-annotate-convert-time "vc-annotate" (&optional time)) 387(declare-function vc-annotate-convert-time "vc-annotate" (&optional time))
388 388
389;; The format for one line output by "hg annotate -d -n" looks like this: 389;; One line printed by "hg annotate -dq -n -u --follow" looks like this:
390;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS 390;; b56girard 114590 2012-03-13 CLOBBER: Lorem ipsum dolor sit
391;; i.e: VERSION_NUMBER DATE: CONTENTS 391;; i.e. AUTHOR REVISION DATE FILENAME: CONTENTS
392;; If the user has set the "--follow" option, the output looks like: 392;; The user can omit options "-u" and/or "--follow". Then it'll look like:
393;;215 Wed Jun 20 21:22:58 2007 -0700 foo.c: CONTENTS 393;; 114590 2012-03-13 CLOBBER:
394;; i.e. VERSION_NUMBER DATE FILENAME: CONTENTS 394;; or
395;; b56girard 114590 2012-03-13:
395(defconst vc-hg-annotate-re 396(defconst vc-hg-annotate-re
396 "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\)\\(?:\\(: \\)\\|\\(?: +\\([^:\n]+\\(?::\\(?:[^: \n][^:\n]*\\)?\\)*\\): \\)\\)") 397 (concat
398 "^\\(?: *[^ ]+ +\\)?\\([0-9]+\\) " ;User and revision.
399 "\\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\)" ;Date.
400 "\\(?: +\\([^:]+\\)\\)?:")) ;Filename.
397 401
398(defun vc-hg-annotate-time () 402(defun vc-hg-annotate-time ()
399 (when (looking-at vc-hg-annotate-re) 403 (when (looking-at vc-hg-annotate-re)
400 (goto-char (match-end 0)) 404 (goto-char (match-end 0))
401 (vc-annotate-convert-time 405 (vc-annotate-convert-time
402 (date-to-time (match-string-no-properties 2))))) 406 (let ((str (match-string-no-properties 2)))
407 (encode-time 0 0 0
408 (string-to-number (substring str 6 8))
409 (string-to-number (substring str 4 6))
410 (string-to-number (substring str 0 4)))))))
403 411
404(defun vc-hg-annotate-extract-revision-at-line () 412(defun vc-hg-annotate-extract-revision-at-line ()
405 (save-excursion 413 (save-excursion
406 (beginning-of-line) 414 (beginning-of-line)
407 (when (looking-at vc-hg-annotate-re) 415 (when (looking-at vc-hg-annotate-re)
408 (if (match-beginning 3) 416 (if (match-beginning 3)
409 (match-string-no-properties 1) 417 (cons (match-string-no-properties 1)
410 (cons (match-string-no-properties 1) 418 (expand-file-name (match-string-no-properties 3)
411 (expand-file-name (match-string-no-properties 4) 419 (vc-hg-root default-directory)))
412 (vc-hg-root default-directory))))))) 420 (match-string-no-properties 1)))))
413 421
414;;; Tag system 422;;; Tag system
415 423