diff options
Diffstat (limited to 'lisp/simple.el')
| -rw-r--r-- | lisp/simple.el | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 76cd990ba03..a6aa4daf04e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -35,6 +35,13 @@ | |||
| 35 | (autoload 'widget-convert "wid-edit") | 35 | (autoload 'widget-convert "wid-edit") |
| 36 | (autoload 'shell-mode "shell")) | 36 | (autoload 'shell-mode "shell")) |
| 37 | 37 | ||
| 38 | (defcustom idle-update-delay 0.5 | ||
| 39 | "*Idle time delay before updating various things on the screen. | ||
| 40 | Various Emacs features that update auxiliary information when point moves | ||
| 41 | wait this many seconds after Emacs becomes idle before doing an update." | ||
| 42 | :type 'number | ||
| 43 | :group 'display | ||
| 44 | :version "22.1") | ||
| 38 | 45 | ||
| 39 | (defgroup killing nil | 46 | (defgroup killing nil |
| 40 | "Killing and yanking commands." | 47 | "Killing and yanking commands." |
| @@ -105,6 +112,8 @@ If `fringe-arrow', indicate the locus by the fringe arrow." | |||
| 105 | :group 'next-error | 112 | :group 'next-error |
| 106 | :version "22.1") | 113 | :version "22.1") |
| 107 | 114 | ||
| 115 | (defvar next-error-highlight-timer nil) | ||
| 116 | |||
| 108 | (defvar next-error-last-buffer nil | 117 | (defvar next-error-last-buffer nil |
| 109 | "The most recent next-error buffer. | 118 | "The most recent next-error buffer. |
| 110 | A buffer becomes most recent when its compilation, grep, or | 119 | A buffer becomes most recent when its compilation, grep, or |
| @@ -2216,6 +2225,42 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." | |||
| 2216 | (reset-this-command-lengths) | 2225 | (reset-this-command-lengths) |
| 2217 | (restore-overriding-map)) | 2226 | (restore-overriding-map)) |
| 2218 | 2227 | ||
| 2228 | (defvar buffer-substring-filters nil | ||
| 2229 | "List of filter functions for `filter-buffer-substring'. | ||
| 2230 | Each function must accept a single argument, a string, and return | ||
| 2231 | a string. The buffer substring is passed to the first function | ||
| 2232 | in the list, and the return value of each function is passed to | ||
| 2233 | the next. The return value of the last function is used as the | ||
| 2234 | return value of `filter-buffer-substring'. | ||
| 2235 | |||
| 2236 | If this variable is nil, no filtering is performed.") | ||
| 2237 | |||
| 2238 | (defun filter-buffer-substring (beg end &optional delete) | ||
| 2239 | "Return the buffer substring between BEG and END, after filtering. | ||
| 2240 | The buffer substring is passed through each of the filter | ||
| 2241 | functions in `buffer-substring-filters', and the value from the | ||
| 2242 | last filter function is returned. If `buffer-substring-filters' | ||
| 2243 | is nil, the buffer substring is returned unaltered. | ||
| 2244 | |||
| 2245 | If DELETE is non-nil, the text between BEG and END is deleted | ||
| 2246 | from the buffer. | ||
| 2247 | |||
| 2248 | Point is temporarily set to BEG before caling | ||
| 2249 | `buffer-substring-filters', in case the functions need to know | ||
| 2250 | where the text came from. | ||
| 2251 | |||
| 2252 | This function should be used instead of `buffer-substring' or | ||
| 2253 | `delete-and-extract-region' when you want to allow filtering to | ||
| 2254 | take place. For example, major or minor modes can use | ||
| 2255 | `buffer-substring-filters' to extract characters that are special | ||
| 2256 | to a buffer, and should not be copied into other buffers." | ||
| 2257 | (save-excursion | ||
| 2258 | (goto-char beg) | ||
| 2259 | (let ((string (if delete (delete-and-extract-region beg end) | ||
| 2260 | (buffer-substring beg end)))) | ||
| 2261 | (dolist (filter buffer-substring-filters string) | ||
| 2262 | (setq string (funcall filter string)))))) | ||
| 2263 | |||
| 2219 | ;;;; Window system cut and paste hooks. | 2264 | ;;;; Window system cut and paste hooks. |
| 2220 | 2265 | ||
| 2221 | (defvar interprogram-cut-function nil | 2266 | (defvar interprogram-cut-function nil |
| @@ -2392,7 +2437,7 @@ specifies the yank-handler text property to be set on the killed | |||
| 2392 | text. See `insert-for-yank'." | 2437 | text. See `insert-for-yank'." |
| 2393 | (interactive "r") | 2438 | (interactive "r") |
| 2394 | (condition-case nil | 2439 | (condition-case nil |
| 2395 | (let ((string (delete-and-extract-region beg end))) | 2440 | (let ((string (filter-buffer-substring beg end t))) |
| 2396 | (when string ;STRING is nil if BEG = END | 2441 | (when string ;STRING is nil if BEG = END |
| 2397 | ;; Add that string to the kill ring, one way or another. | 2442 | ;; Add that string to the kill ring, one way or another. |
| 2398 | (if (eq last-command 'kill-region) | 2443 | (if (eq last-command 'kill-region) |
| @@ -2428,8 +2473,8 @@ If `interprogram-cut-function' is non-nil, also save the text for a window | |||
| 2428 | system cut and paste." | 2473 | system cut and paste." |
| 2429 | (interactive "r") | 2474 | (interactive "r") |
| 2430 | (if (eq last-command 'kill-region) | 2475 | (if (eq last-command 'kill-region) |
| 2431 | (kill-append (buffer-substring beg end) (< end beg)) | 2476 | (kill-append (filter-buffer-substring beg end) (< end beg)) |
| 2432 | (kill-new (buffer-substring beg end))) | 2477 | (kill-new (filter-buffer-substring beg end))) |
| 2433 | (if transient-mark-mode | 2478 | (if transient-mark-mode |
| 2434 | (setq deactivate-mark t)) | 2479 | (setq deactivate-mark t)) |
| 2435 | nil) | 2480 | nil) |
| @@ -2954,7 +2999,7 @@ the user to see that the mark has moved, and you want the previous | |||
| 2954 | mark position to be lost. | 2999 | mark position to be lost. |
| 2955 | 3000 | ||
| 2956 | Normally, when a new mark is set, the old one should go on the stack. | 3001 | Normally, when a new mark is set, the old one should go on the stack. |
| 2957 | This is why most applications should use push-mark, not set-mark. | 3002 | This is why most applications should use `push-mark', not `set-mark'. |
| 2958 | 3003 | ||
| 2959 | Novice Emacs Lisp programmers often try to use the mark for the wrong | 3004 | Novice Emacs Lisp programmers often try to use the mark for the wrong |
| 2960 | purposes. The mark saves a location for the user's convenience. | 3005 | purposes. The mark saves a location for the user's convenience. |
| @@ -5182,14 +5227,6 @@ See also `normal-erase-is-backspace'." | |||
| 5182 | (message "Delete key deletes %s" | 5227 | (message "Delete key deletes %s" |
| 5183 | (if normal-erase-is-backspace "forward" "backward")))) | 5228 | (if normal-erase-is-backspace "forward" "backward")))) |
| 5184 | 5229 | ||
| 5185 | (defcustom idle-update-delay 0.5 | ||
| 5186 | "*Idle time delay before updating various things on the screen. | ||
| 5187 | Various Emacs features that update auxiliary information when point moves | ||
| 5188 | wait this many seconds after Emacs becomes idle before doing an update." | ||
| 5189 | :type 'number | ||
| 5190 | :group 'display | ||
| 5191 | :version "22.1") | ||
| 5192 | |||
| 5193 | (defvar vis-mode-saved-buffer-invisibility-spec nil | 5230 | (defvar vis-mode-saved-buffer-invisibility-spec nil |
| 5194 | "Saved value of `buffer-invisibility-spec' when Visible mode is on.") | 5231 | "Saved value of `buffer-invisibility-spec' when Visible mode is on.") |
| 5195 | 5232 | ||