diff options
| author | Stefan Monnier | 2020-01-21 09:16:25 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2020-01-21 09:16:25 -0500 |
| commit | c1b6cf6757fbd00cf6e8cae23e1670b9ff794811 (patch) | |
| tree | 0fb696878e2f766f6117e7eac359659f0e9d4b97 | |
| parent | ee1ccb428e7560fa973b9da3918a097f864298b3 (diff) | |
| download | emacs-c1b6cf6757fbd00cf6e8cae23e1670b9ff794811.tar.gz emacs-c1b6cf6757fbd00cf6e8cae23e1670b9ff794811.zip | |
* lisp/progmodes/grep.el (grep-read-files-function): New var.
Also remove redundant :groups while we're here.
(grep-read-files): Use it instead of a major-mode symbol property.
(grep-read-files--default): New function.
* lisp/dired.el (dired-mode): Use `grep-read-files-function`.
| -rw-r--r-- | lisp/dired.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 111 |
2 files changed, 53 insertions, 60 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 98e3be72278..0e0b25eac8c 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -851,7 +851,6 @@ If a directory or nothing is found at point, return nil." | |||
| 851 | (if (and file-name | 851 | (if (and file-name |
| 852 | (not (file-directory-p file-name))) | 852 | (not (file-directory-p file-name))) |
| 853 | file-name))) | 853 | file-name))) |
| 854 | (put 'dired-mode 'grep-read-files 'dired-grep-read-files) | ||
| 855 | 854 | ||
| 856 | ;;;###autoload (define-key ctl-x-map "d" 'dired) | 855 | ;;;###autoload (define-key ctl-x-map "d" 'dired) |
| 857 | ;;;###autoload | 856 | ;;;###autoload |
| @@ -2244,6 +2243,7 @@ Keybindings: | |||
| 2244 | (setq-local font-lock-defaults | 2243 | (setq-local font-lock-defaults |
| 2245 | '(dired-font-lock-keywords t nil nil beginning-of-line)) | 2244 | '(dired-font-lock-keywords t nil nil beginning-of-line)) |
| 2246 | (setq-local desktop-save-buffer 'dired-desktop-buffer-misc-data) | 2245 | (setq-local desktop-save-buffer 'dired-desktop-buffer-misc-data) |
| 2246 | (setq-local grep-read-files-function #'dired-grep-read-files) | ||
| 2247 | (setq dired-switches-alist nil) | 2247 | (setq dired-switches-alist nil) |
| 2248 | (hack-dir-local-variables-non-file-buffer) ; before sorting | 2248 | (hack-dir-local-variables-non-file-buffer) ; before sorting |
| 2249 | (dired-sort-other dired-actual-switches t) | 2249 | (dired-sort-other dired-actual-switches t) |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index d4aca28bd7c..7731be59659 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -64,8 +64,7 @@ SYMBOL should be one of `grep-command', `grep-template', | |||
| 64 | "Number of lines in a grep window. If nil, use `compilation-window-height'." | 64 | "Number of lines in a grep window. If nil, use `compilation-window-height'." |
| 65 | :type '(choice (const :tag "Default" nil) | 65 | :type '(choice (const :tag "Default" nil) |
| 66 | integer) | 66 | integer) |
| 67 | :version "22.1" | 67 | :version "22.1") |
| 68 | :group 'grep) | ||
| 69 | 68 | ||
| 70 | (defcustom grep-highlight-matches 'auto-detect | 69 | (defcustom grep-highlight-matches 'auto-detect |
| 71 | "Use special markers to highlight grep matches. | 70 | "Use special markers to highlight grep matches. |
| @@ -98,9 +97,8 @@ To change the default value, use \\[customize] or call the function | |||
| 98 | (const :tag "Use --color=always" always) | 97 | (const :tag "Use --color=always" always) |
| 99 | (const :tag "Use --color" auto) | 98 | (const :tag "Use --color" auto) |
| 100 | (other :tag "Not Set" auto-detect)) | 99 | (other :tag "Not Set" auto-detect)) |
| 101 | :set 'grep-apply-setting | 100 | :set #'grep-apply-setting |
| 102 | :version "22.1" | 101 | :version "22.1") |
| 103 | :group 'grep) | ||
| 104 | 102 | ||
| 105 | (defcustom grep-scroll-output nil | 103 | (defcustom grep-scroll-output nil |
| 106 | "Non-nil to scroll the *grep* buffer window as output appears. | 104 | "Non-nil to scroll the *grep* buffer window as output appears. |
| @@ -109,8 +107,7 @@ Setting it causes the grep commands to put point at the end of their | |||
| 109 | output window so that the end of the output is always visible rather | 107 | output window so that the end of the output is always visible rather |
| 110 | than the beginning." | 108 | than the beginning." |
| 111 | :type 'boolean | 109 | :type 'boolean |
| 112 | :version "22.1" | 110 | :version "22.1") |
| 113 | :group 'grep) | ||
| 114 | 111 | ||
| 115 | ;;;###autoload | 112 | ;;;###autoload |
| 116 | (defcustom grep-command nil | 113 | (defcustom grep-command nil |
| @@ -124,8 +121,7 @@ by `grep-compute-defaults'; to change the default value, use | |||
| 124 | \\[customize] or call the function `grep-apply-setting'." | 121 | \\[customize] or call the function `grep-apply-setting'." |
| 125 | :type '(choice string | 122 | :type '(choice string |
| 126 | (const :tag "Not Set" nil)) | 123 | (const :tag "Not Set" nil)) |
| 127 | :set 'grep-apply-setting | 124 | :set #'grep-apply-setting) |
| 128 | :group 'grep) | ||
| 129 | 125 | ||
| 130 | (defcustom grep-template nil | 126 | (defcustom grep-template nil |
| 131 | "The default command to run for \\[lgrep]. | 127 | "The default command to run for \\[lgrep]. |
| @@ -141,9 +137,8 @@ by `grep-compute-defaults'; to change the default value, use | |||
| 141 | \\[customize] or call the function `grep-apply-setting'." | 137 | \\[customize] or call the function `grep-apply-setting'." |
| 142 | :type '(choice string | 138 | :type '(choice string |
| 143 | (const :tag "Not Set" nil)) | 139 | (const :tag "Not Set" nil)) |
| 144 | :set 'grep-apply-setting | 140 | :set #'grep-apply-setting |
| 145 | :version "22.1" | 141 | :version "22.1") |
| 146 | :group 'grep) | ||
| 147 | 142 | ||
| 148 | (defcustom grep-use-null-device 'auto-detect | 143 | (defcustom grep-use-null-device 'auto-detect |
| 149 | "If t, append the value of `null-device' to `grep' commands. | 144 | "If t, append the value of `null-device' to `grep' commands. |
| @@ -157,8 +152,7 @@ by `grep-compute-defaults'; to change the default value, use | |||
| 157 | :type '(choice (const :tag "Do Not Append Null Device" nil) | 152 | :type '(choice (const :tag "Do Not Append Null Device" nil) |
| 158 | (const :tag "Append Null Device" t) | 153 | (const :tag "Append Null Device" t) |
| 159 | (other :tag "Not Set" auto-detect)) | 154 | (other :tag "Not Set" auto-detect)) |
| 160 | :set 'grep-apply-setting | 155 | :set #'grep-apply-setting) |
| 161 | :group 'grep) | ||
| 162 | 156 | ||
| 163 | (defcustom grep-use-null-filename-separator 'auto-detect | 157 | (defcustom grep-use-null-filename-separator 'auto-detect |
| 164 | "If non-nil, use `grep's `--null' option. | 158 | "If non-nil, use `grep's `--null' option. |
| @@ -167,8 +161,7 @@ This is done to disambiguate file names in `grep's output." | |||
| 167 | :type '(choice (const :tag "Do Not Use `--null'" nil) | 161 | :type '(choice (const :tag "Do Not Use `--null'" nil) |
| 168 | (const :tag "Use `--null'" t) | 162 | (const :tag "Use `--null'" t) |
| 169 | (other :tag "Not Set" auto-detect)) | 163 | (other :tag "Not Set" auto-detect)) |
| 170 | :set 'grep-apply-setting | 164 | :set #'grep-apply-setting) |
| 171 | :group 'grep) | ||
| 172 | 165 | ||
| 173 | ;;;###autoload | 166 | ;;;###autoload |
| 174 | (defcustom grep-find-command nil | 167 | (defcustom grep-find-command nil |
| @@ -178,8 +171,7 @@ by `grep-compute-defaults'; to change the default value, use | |||
| 178 | \\[customize] or call the function `grep-apply-setting'." | 171 | \\[customize] or call the function `grep-apply-setting'." |
| 179 | :type '(choice string | 172 | :type '(choice string |
| 180 | (const :tag "Not Set" nil)) | 173 | (const :tag "Not Set" nil)) |
| 181 | :set 'grep-apply-setting | 174 | :set #'grep-apply-setting) |
| 182 | :group 'grep) | ||
| 183 | 175 | ||
| 184 | (defcustom grep-find-template nil | 176 | (defcustom grep-find-template nil |
| 185 | "The default command to run for \\[rgrep]. | 177 | "The default command to run for \\[rgrep]. |
| @@ -194,9 +186,8 @@ by `grep-compute-defaults'; to change the default value, use | |||
| 194 | \\[customize] or call the function `grep-apply-setting'." | 186 | \\[customize] or call the function `grep-apply-setting'." |
| 195 | :type '(choice string | 187 | :type '(choice string |
| 196 | (const :tag "Not Set" nil)) | 188 | (const :tag "Not Set" nil)) |
| 197 | :set 'grep-apply-setting | 189 | :set #'grep-apply-setting |
| 198 | :version "22.1" | 190 | :version "22.1") |
| 199 | :group 'grep) | ||
| 200 | 191 | ||
| 201 | (defcustom grep-files-aliases | 192 | (defcustom grep-files-aliases |
| 202 | '(("all" . "* .[!.]* ..?*") ;; Don't match `..'. See bug#22577 | 193 | '(("all" . "* .[!.]* ..?*") ;; Don't match `..'. See bug#22577 |
| @@ -213,8 +204,7 @@ by `grep-compute-defaults'; to change the default value, use | |||
| 213 | ("texi" . "*.texi") | 204 | ("texi" . "*.texi") |
| 214 | ("asm" . "*.[sS]")) | 205 | ("asm" . "*.[sS]")) |
| 215 | "Alist of aliases for the FILES argument to `lgrep' and `rgrep'." | 206 | "Alist of aliases for the FILES argument to `lgrep' and `rgrep'." |
| 216 | :type 'alist | 207 | :type 'alist) |
| 217 | :group 'grep) | ||
| 218 | 208 | ||
| 219 | (defcustom grep-find-ignored-directories vc-directory-exclusion-list | 209 | (defcustom grep-find-ignored-directories vc-directory-exclusion-list |
| 220 | "List of names of sub-directories which `rgrep' shall not recurse into. | 210 | "List of names of sub-directories which `rgrep' shall not recurse into. |
| @@ -223,8 +213,7 @@ to determine whether cdr should not be recursed into. | |||
| 223 | 213 | ||
| 224 | The default value is inherited from `vc-directory-exclusion-list'." | 214 | The default value is inherited from `vc-directory-exclusion-list'." |
| 225 | :type '(choice (repeat :tag "Ignored directories" string) | 215 | :type '(choice (repeat :tag "Ignored directories" string) |
| 226 | (const :tag "No ignored directories" nil)) | 216 | (const :tag "No ignored directories" nil))) |
| 227 | :group 'grep) | ||
| 228 | 217 | ||
| 229 | (defcustom grep-find-ignored-files | 218 | (defcustom grep-find-ignored-files |
| 230 | (cons ".#*" (delq nil (mapcar (lambda (s) | 219 | (cons ".#*" (delq nil (mapcar (lambda (s) |
| @@ -235,8 +224,7 @@ The default value is inherited from `vc-directory-exclusion-list'." | |||
| 235 | If an element is a cons cell, the car is called on the search directory | 224 | If an element is a cons cell, the car is called on the search directory |
| 236 | to determine whether cdr should not be excluded." | 225 | to determine whether cdr should not be excluded." |
| 237 | :type '(choice (repeat :tag "Ignored file" string) | 226 | :type '(choice (repeat :tag "Ignored file" string) |
| 238 | (const :tag "No ignored files" nil)) | 227 | (const :tag "No ignored files" nil))) |
| 239 | :group 'grep) | ||
| 240 | 228 | ||
| 241 | (defcustom grep-save-buffers 'ask | 229 | (defcustom grep-save-buffers 'ask |
| 242 | "If non-nil, save buffers before running the grep commands. | 230 | "If non-nil, save buffers before running the grep commands. |
| @@ -251,22 +239,19 @@ to limit saving to files located under `my-grep-root'." | |||
| 251 | (const :tag "Ask before saving" ask) | 239 | (const :tag "Ask before saving" ask) |
| 252 | (const :tag "Don't save buffers" nil) | 240 | (const :tag "Don't save buffers" nil) |
| 253 | function | 241 | function |
| 254 | (other :tag "Save all buffers" t)) | 242 | (other :tag "Save all buffers" t))) |
| 255 | :group 'grep) | ||
| 256 | 243 | ||
| 257 | (defcustom grep-error-screen-columns nil | 244 | (defcustom grep-error-screen-columns nil |
| 258 | "If non-nil, column numbers in grep hits are screen columns. | 245 | "If non-nil, column numbers in grep hits are screen columns. |
| 259 | See `compilation-error-screen-columns'." | 246 | See `compilation-error-screen-columns'." |
| 260 | :type '(choice (const :tag "Default" nil) | 247 | :type '(choice (const :tag "Default" nil) |
| 261 | integer) | 248 | integer) |
| 262 | :version "22.1" | 249 | :version "22.1") |
| 263 | :group 'grep) | ||
| 264 | 250 | ||
| 265 | ;;;###autoload | 251 | ;;;###autoload |
| 266 | (defcustom grep-setup-hook nil | 252 | (defcustom grep-setup-hook nil |
| 267 | "List of hook functions run by `grep-process-setup' (see `run-hooks')." | 253 | "List of hook functions run by `grep-process-setup' (see `run-hooks')." |
| 268 | :type 'hook | 254 | :type 'hook) |
| 269 | :group 'grep) | ||
| 270 | 255 | ||
| 271 | (defvar grep-mode-map | 256 | (defvar grep-mode-map |
| 272 | (let ((map (make-sparse-keymap))) | 257 | (let ((map (make-sparse-keymap))) |
| @@ -333,7 +318,10 @@ See `compilation-error-screen-columns'." | |||
| 333 | ;; When bootstrapping, tool-bar-map is not properly initialized yet, | 318 | ;; When bootstrapping, tool-bar-map is not properly initialized yet, |
| 334 | ;; so don't do anything. | 319 | ;; so don't do anything. |
| 335 | (when (keymapp (butlast tool-bar-map)) | 320 | (when (keymapp (butlast tool-bar-map)) |
| 321 | ;; We have to `copy-keymap' rather than use keymap inheritance because | ||
| 322 | ;; we want to put the new items at the *end* of the tool-bar. | ||
| 336 | (let ((map (butlast (copy-keymap tool-bar-map))) | 323 | (let ((map (butlast (copy-keymap tool-bar-map))) |
| 324 | ;; FIXME: Nowadays the last button is not "help" but "search"! | ||
| 337 | (help (last tool-bar-map))) ;; Keep Help last in tool bar | 325 | (help (last tool-bar-map))) ;; Keep Help last in tool bar |
| 338 | (tool-bar-local-item | 326 | (tool-bar-local-item |
| 339 | "left-arrow" 'previous-error-no-select 'previous-error-no-select map | 327 | "left-arrow" 'previous-error-no-select 'previous-error-no-select map |
| @@ -439,15 +427,13 @@ and reveals the entire command line. The visibility of the | |||
| 439 | abbreviated part can also be toggled with | 427 | abbreviated part can also be toggled with |
| 440 | `grep-find-toggle-abbreviation'." | 428 | `grep-find-toggle-abbreviation'." |
| 441 | :type 'boolean | 429 | :type 'boolean |
| 442 | :version "27.1" | 430 | :version "27.1") |
| 443 | :group 'grep) | ||
| 444 | 431 | ||
| 445 | (defcustom grep-search-path '(nil) | 432 | (defcustom grep-search-path '(nil) |
| 446 | "List of directories to search for files named in grep messages. | 433 | "List of directories to search for files named in grep messages. |
| 447 | Elements should be directory names, not file names of | 434 | Elements should be directory names, not file names of |
| 448 | directories. The value nil as an element means the grep messages | 435 | directories. The value nil as an element means the grep messages |
| 449 | buffer `default-directory'." | 436 | buffer `default-directory'." |
| 450 | :group 'grep | ||
| 451 | :version "27.1" | 437 | :version "27.1" |
| 452 | :type '(repeat (choice (const :tag "Default" nil) | 438 | :type '(repeat (choice (const :tag "Default" nil) |
| 453 | (string :tag "Directory")))) | 439 | (string :tag "Directory")))) |
| @@ -528,9 +514,8 @@ This variable's value takes effect when `grep-compute-defaults' is called." | |||
| 528 | (const :tag "find -print0 | sort -z | xargs -0'" gnu-sort) | 514 | (const :tag "find -print0 | sort -z | xargs -0'" gnu-sort) |
| 529 | string | 515 | string |
| 530 | (const :tag "Not Set" nil)) | 516 | (const :tag "Not Set" nil)) |
| 531 | :set 'grep-apply-setting | 517 | :set #'grep-apply-setting |
| 532 | :version "27.1" | 518 | :version "27.1") |
| 533 | :group 'grep) | ||
| 534 | 519 | ||
| 535 | ;; History of grep commands. | 520 | ;; History of grep commands. |
| 536 | ;;;###autoload | 521 | ;;;###autoload |
| @@ -562,7 +547,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 562 | (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne")) | 547 | (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne")) |
| 563 | (setq-local grep-num-matches-found 0) | 548 | (setq-local grep-num-matches-found 0) |
| 564 | (set (make-local-variable 'compilation-exit-message-function) | 549 | (set (make-local-variable 'compilation-exit-message-function) |
| 565 | 'grep-exit-message) | 550 | #'grep-exit-message) |
| 566 | (run-hooks 'grep-setup-hook)) | 551 | (run-hooks 'grep-setup-hook)) |
| 567 | 552 | ||
| 568 | (defun grep-exit-message (status code msg) | 553 | (defun grep-exit-message (status code msg) |
| @@ -612,7 +597,7 @@ This function is called from `compilation-filter-hook'." | |||
| 612 | (defun grep-probe (command args &optional func result) | 597 | (defun grep-probe (command args &optional func result) |
| 613 | (let (process-file-side-effects) | 598 | (let (process-file-side-effects) |
| 614 | (equal (condition-case nil | 599 | (equal (condition-case nil |
| 615 | (apply (or func 'process-file) command args) | 600 | (apply (or func #'process-file) command args) |
| 616 | (error nil)) | 601 | (error nil)) |
| 617 | (or result 0)))) | 602 | (or result 0)))) |
| 618 | 603 | ||
| @@ -808,7 +793,7 @@ The value depends on `grep-command', `grep-template', | |||
| 808 | (buffer-substring-no-properties (point) (mark))) | 793 | (buffer-substring-no-properties (point) (mark))) |
| 809 | (funcall (or find-tag-default-function | 794 | (funcall (or find-tag-default-function |
| 810 | (get major-mode 'find-tag-default-function) | 795 | (get major-mode 'find-tag-default-function) |
| 811 | 'find-tag-default)) | 796 | #'find-tag-default)) |
| 812 | "")) | 797 | "")) |
| 813 | 798 | ||
| 814 | (defun grep-default-command () | 799 | (defun grep-default-command () |
| @@ -863,11 +848,11 @@ The value depends on `grep-command', `grep-template', | |||
| 863 | (set (make-local-variable 'compilation-directory-matcher) | 848 | (set (make-local-variable 'compilation-directory-matcher) |
| 864 | (list regexp-unmatchable)) | 849 | (list regexp-unmatchable)) |
| 865 | (set (make-local-variable 'compilation-process-setup-function) | 850 | (set (make-local-variable 'compilation-process-setup-function) |
| 866 | 'grep-process-setup) | 851 | #'grep-process-setup) |
| 867 | (set (make-local-variable 'compilation-disable-input) t) | 852 | (set (make-local-variable 'compilation-disable-input) t) |
| 868 | (set (make-local-variable 'compilation-error-screen-columns) | 853 | (set (make-local-variable 'compilation-error-screen-columns) |
| 869 | grep-error-screen-columns) | 854 | grep-error-screen-columns) |
| 870 | (add-hook 'compilation-filter-hook 'grep-filter nil t)) | 855 | (add-hook 'compilation-filter-hook #'grep-filter nil t)) |
| 871 | 856 | ||
| 872 | (defun grep--save-buffers () | 857 | (defun grep--save-buffers () |
| 873 | (when grep-save-buffers | 858 | (when grep-save-buffers |
| @@ -914,7 +899,7 @@ list is empty)." | |||
| 914 | (compilation-start (if (and grep-use-null-device null-device) | 899 | (compilation-start (if (and grep-use-null-device null-device) |
| 915 | (concat command-args " " null-device) | 900 | (concat command-args " " null-device) |
| 916 | command-args) | 901 | command-args) |
| 917 | 'grep-mode)) | 902 | #'grep-mode)) |
| 918 | 903 | ||
| 919 | 904 | ||
| 920 | ;;;###autoload | 905 | ;;;###autoload |
| @@ -993,23 +978,31 @@ these include `opts', `dir', `files', `null-device', `excl' and | |||
| 993 | "Read regexp arg for interactive grep using `read-regexp'." | 978 | "Read regexp arg for interactive grep using `read-regexp'." |
| 994 | (read-regexp "Search for" 'grep-tag-default 'grep-regexp-history)) | 979 | (read-regexp "Search for" 'grep-tag-default 'grep-regexp-history)) |
| 995 | 980 | ||
| 981 | (defvar grep-read-files-function #'grep-read-files--default) | ||
| 982 | |||
| 983 | (defun grep-read-files--default () | ||
| 984 | ;; Instead of a `grep-read-files-function' variable, we used to lookup | ||
| 985 | ;; mode-specific functions in the major mode's symbol properties, so preserve | ||
| 986 | ;; this behavior for backward compatibility. | ||
| 987 | (let ((old-function (get major-mode 'grep-read-files))) ;Obsolete since 28.1 | ||
| 988 | (if old-function | ||
| 989 | (funcall old-function) | ||
| 990 | (let ((file-name-at-point | ||
| 991 | (run-hook-with-args-until-success 'file-name-at-point-functions))) | ||
| 992 | (or (if (and (stringp file-name-at-point) | ||
| 993 | (not (file-directory-p file-name-at-point))) | ||
| 994 | file-name-at-point) | ||
| 995 | (buffer-file-name) | ||
| 996 | (replace-regexp-in-string "<[0-9]+>\\'" "" (buffer-name))))))) | ||
| 997 | |||
| 996 | (defun grep-read-files (regexp) | 998 | (defun grep-read-files (regexp) |
| 997 | "Read a file-name pattern arg for interactive grep. | 999 | "Read a file-name pattern arg for interactive grep. |
| 998 | The pattern can include shell wildcards. As whitespace triggers | 1000 | The pattern can include shell wildcards. As SPC can triggers |
| 999 | completion when entering a pattern, including it requires | 1001 | completion when entering a pattern, including it requires |
| 1000 | quoting, e.g. `\\[quoted-insert]<space>'. | 1002 | quoting, e.g. `\\[quoted-insert]<space>'. |
| 1001 | 1003 | ||
| 1002 | REGEXP is used as a string in the prompt." | 1004 | REGEXP is used as a string in the prompt." |
| 1003 | (let* ((grep-read-files-function (get major-mode 'grep-read-files)) | 1005 | (let* ((bn (funcall grep-read-files-function)) |
| 1004 | (file-name-at-point | ||
| 1005 | (run-hook-with-args-until-success 'file-name-at-point-functions)) | ||
| 1006 | (bn (if grep-read-files-function | ||
| 1007 | (funcall grep-read-files-function) | ||
| 1008 | (or (if (and (stringp file-name-at-point) | ||
| 1009 | (not (file-directory-p file-name-at-point))) | ||
| 1010 | file-name-at-point) | ||
| 1011 | (buffer-file-name) | ||
| 1012 | (replace-regexp-in-string "<[0-9]+>\\'" "" (buffer-name))))) | ||
| 1013 | (fn (and bn | 1006 | (fn (and bn |
| 1014 | (stringp bn) | 1007 | (stringp bn) |
| 1015 | (file-name-nondirectory bn))) | 1008 | (file-name-nondirectory bn))) |
| @@ -1022,7 +1015,7 @@ REGEXP is used as a string in the prompt." | |||
| 1022 | (setq alias (car aliases) | 1015 | (setq alias (car aliases) |
| 1023 | aliases (cdr aliases)) | 1016 | aliases (cdr aliases)) |
| 1024 | (if (string-match (mapconcat | 1017 | (if (string-match (mapconcat |
| 1025 | 'wildcard-to-regexp | 1018 | #'wildcard-to-regexp |
| 1026 | (split-string (cdr alias) nil t) | 1019 | (split-string (cdr alias) nil t) |
| 1027 | "\\|") | 1020 | "\\|") |
| 1028 | fn) | 1021 | fn) |
| @@ -1043,11 +1036,11 @@ REGEXP is used as a string in the prompt." | |||
| 1043 | "\" in files matching wildcard" | 1036 | "\" in files matching wildcard" |
| 1044 | (if default (concat " (default " default ")")) | 1037 | (if default (concat " (default " default ")")) |
| 1045 | ": ") | 1038 | ": ") |
| 1046 | 'read-file-name-internal | 1039 | #'read-file-name-internal |
| 1047 | nil nil nil 'grep-files-history | 1040 | nil nil nil 'grep-files-history |
| 1048 | (delete-dups | 1041 | (delete-dups |
| 1049 | (delq nil (append (list default default-alias default-extension) | 1042 | (delq nil (append (list default default-alias default-extension) |
| 1050 | (mapcar 'car grep-files-aliases))))))) | 1043 | (mapcar #'car grep-files-aliases))))))) |
| 1051 | (and files | 1044 | (and files |
| 1052 | (or (cdr (assoc files grep-files-aliases)) | 1045 | (or (cdr (assoc files grep-files-aliases)) |
| 1053 | files)))) | 1046 | files)))) |