summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-07-10 13:27:36 +0200
committerStefan Kangas <stefankangas@gmail.com>2022-09-09 11:27:30 +0200
commit1f29ee2d21b57e81a28550a1b31bc8a39406d17b (patch)
tree753106efb2241a17c5949255b7b457f7ad210f77 /lisp/replace.el
parentc6d8db8d91649d4e30bb26c662ac867136005c0c (diff)
downloademacs-1f29ee2d21b57e81a28550a1b31bc8a39406d17b.tar.gz
Delete many items obsolete since 24.3
* lisp/allout.el (allout-exposure-change-hook) (allout-structure-added-hook, allout-structure-deleted-hook) (allout-structure-shifted-hook): * lisp/arc-mode.el (archive-extract-hooks): * lisp/buff-menu.el (Buffer-menu-buffer+size-width): * lisp/calendar/timeclock.el (timeclock-modeline-display) (timeclock-modeline-display, timeclock-update-modeline): * lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym-function-arglist): * lisp/cedet/semantic/db-file.el (semanticdb-save-database-hooks): * lisp/cedet/semantic/edit.el (semantic-change-hooks) (semantic-edits-new-change-hooks) (semantic-edits-delete-change-hooks) (semantic-edits-reparse-change-hooks): * lisp/cedet/semantic/lex.el (semantic-lex-reset-hooks): * lisp/comint.el (comint--unquote&expand-filename) (comint-unquote-filename): * lisp/custom.el (user-variable-p): * lisp/dired.el (dired-shrink-to-fit, dired-pop-to-buffer) (dired-sort-set-modeline): * lisp/ebuff-menu.el (Electric-buffer-menu-mode): * lisp/emacs-lisp/byte-run.el (macro-declaration-function): * lisp/emacs-lisp/checkdoc.el (custom-print-functions) (checkdoc-comment-style-hooks): * lisp/emacs-lisp/cl-lib.el (custom-print-functions): * lisp/emacs-lisp/edebug.el (gud-inhibit-global-bindings): * lisp/erc/erc-dcc.el (erc-dcc-chat-filter-hook): * lisp/eshell/esh-mode.el (eshell-status-in-modeline): * lisp/eshell/eshell.el (eshell-add-to-window-buffer-names) (eshell-remove-from-window-buffer-names): * lisp/faces.el (set-face-underline-p, font-list-limit): * lisp/files.el (automount-dir-prefix, toggle-read-only): * lisp/filesets.el (filesets-cache-fill-content-hooks): * lisp/frame.el (automatic-hscrolling): * lisp/generic-x.el (javascript-generic-mode) (javascript-generic-mode-hook): * lisp/gnus/gnus-start.el (gnus-subscribe-newsgroup-hooks): * lisp/gnus/nndiary.el (nndiary-request-create-group-hooks) (nndiary-request-update-info-hooks) (nndiary-request-accept-article-hooks): * lisp/htmlfontify.el (hfy-post-html-hooks): * lisp/international/mule-cmds.el (inactivate-current-input-method-function) (inactivate-input-method, input-method-inactivate-hook) (ucs-insert): * lisp/international/quail.el (quail-inactivate) (quail-inactivate-hook): * lisp/international/robin.el (robin-inactivate) (robin-inactivate-hook): * lisp/leim/quail/hangul.el (hangul-input-method-inactivate): * lisp/leim/quail/uni-input.el (ucs-input-inactivate): * lisp/mail/emacsbug.el (report-emacs-bug-info): * lisp/mh-e/mh-e.el (mh-kill-folder-suppress-prompt-hooks): * lisp/mpc.el (mpc-string-prefix-p): * lisp/net/rcirc.el (rcirc-print-hooks, rcirc-sentinel-hooks) (rcirc-receive-message-hooks, rcirc-activity-hooks): * lisp/obsolete/crisp.el (crisp-mode-modeline-string): * lisp/pcomplete.el (pcomplete-arg-quote-list) (pcomplete-quote-argument): * lisp/progmodes/cc-mode.el (c-prepare-bug-report-hooks): * lisp/progmodes/python.el (python-info-ppss-context) (python-info-ppss-context-type) (python-info-ppss-comment-or-string-p, python-indent) (python-guess-indent, python-buffer, python-preoutput-result) (python-proc, python-send-receive, python-send-string) (python-use-skeletons): * lisp/progmodes/sh-script.el (sh-maybe-here-document): * lisp/replace.el (query-replace-interactive): * lisp/strokes.el (strokes-modeline-string): * lisp/subr.el (redraw-modeline): * lisp/term.el (term-default-fg-color, term-default-bg-color): * lisp/textmodes/tex-mode.el (latex-string-prefix-p) (tex-string-prefix-p): * lisp/url/url-parse.el (url-recreate-url-attributes): * lisp/vc/add-log.el (change-log-acknowledgement): * lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically): * lisp/vc/pcvs-util.el (cvs-string-prefix-p): * lisp/vc/vc.el (vc-string-prefix-p): * lisp/window.el (display-buffer-function): * lisp/winner.el (winner-mode-leave-hook): Remove many functions and variables obsolete since 24.3. * lisp/buff-menu.el (list-buffers--refresh): * lisp/dired.el (dired-mode-map): * lisp/files.el (abbreviate-file-name): * lisp/generic-x.el (generic-default-modes): * lisp/mh-e/mh-funcs.el (mh-kill-folder): * lisp/progmodes/hideif.el (hide-ifdef-mode-submap): * lisp/replace.el (query-replace-read-from): * lisp/term.el (term): * lisp/window.el (display-buffer): Don't use above deleted functions and variables. * src/marker.c (Fbuffer_has_markers_at): Delete DEFUN obsolete since 24.3. (syms_of_marker) <Sbuffer_has_markers_at>: Delete defsubr. * lisp/subr.el (buffer-has-markers-at): Remove obsoletion of above deleted DEFUN. * etc/TODO: Doc fix; don't mention above deleted function. * admin/cus-test.el (cus-test-get-options): * lisp/pcomplete.el: Doc fixes; don't mention removed items. ; * etc/NEWS: List removed items.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el186
1 files changed, 88 insertions, 98 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 06cde771b9e..6393c092886 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -73,14 +73,6 @@ See `query-replace-from-history-variable' and
This is a list of cons cells (FROM-STRING . TO-STRING), or nil
if there are no default values.")
-(defvar query-replace-interactive nil
- "Non-nil means `query-replace' uses the last search string.
-That becomes the \"string to replace\".")
-(make-obsolete-variable 'query-replace-interactive
- "use `M-n' to pull the last incremental search string
-to the minibuffer that reads the string to replace, or invoke replacements
-from Isearch by using a key sequence like `C-s C-s M-%'." "24.3")
-
(defcustom query-replace-from-to-separator " → "
"String that separates FROM and TO in the history of replacement pairs.
When nil, the pair will not be added to the history (same behavior
@@ -213,96 +205,94 @@ by this function to the end of values available via
Prompt with PROMPT. REGEXP-FLAG non-nil means the response should be a regexp.
The return value can also be a pair (FROM . TO) indicating that the user
wants to replace FROM with TO."
- (if query-replace-interactive
- (car (if regexp-flag regexp-search-ring search-ring))
- (let* ((history-add-new-input nil)
- (separator-string
- (when query-replace-from-to-separator
- ;; Check if the first non-whitespace char is displayable
- (if (char-displayable-p
- (string-to-char (string-replace
- " " "" query-replace-from-to-separator)))
- query-replace-from-to-separator
- " -> ")))
- (separator
- (when separator-string
- (propertize separator-string
- 'display separator-string
- 'face 'minibuffer-prompt
- 'separator t)))
- (minibuffer-history
- (append
- (when separator
- (mapcar (lambda (from-to)
- (concat (query-replace-descr (car from-to))
- separator
- (query-replace-descr (cdr from-to))))
- query-replace-defaults))
- (symbol-value query-replace-from-history-variable)))
- (minibuffer-allow-text-properties t) ; separator uses text-properties
- (default (when (and query-replace-read-from-default (not regexp-flag))
- (funcall query-replace-read-from-default)))
- (prompt
- (cond ((and query-replace-read-from-regexp-default regexp-flag) prompt)
- (default (format-prompt prompt default))
- ((and query-replace-defaults separator)
- (format-prompt prompt (car minibuffer-history)))
- (query-replace-defaults
- (format-prompt
- prompt (format "%s -> %s"
- (query-replace-descr
- (caar query-replace-defaults))
- (query-replace-descr
- (cdar query-replace-defaults)))))
- (t (format-prompt prompt nil))))
- (from
- ;; The save-excursion here is in case the user marks and copies
- ;; a region in order to specify the minibuffer input.
- ;; That should not clobber the region for the query-replace itself.
- (save-excursion
- (minibuffer-with-setup-hook
- (lambda ()
- (setq-local text-property-default-nonsticky
- (append '((separator . t) (face . t))
- text-property-default-nonsticky)))
- (if regexp-flag
- (read-regexp
- (if query-replace-read-from-regexp-default
- (string-remove-suffix ": " prompt)
- prompt)
- query-replace-read-from-regexp-default
- 'minibuffer-history)
- (read-from-minibuffer
- prompt nil nil nil nil
- (if default
- (delete-dups
- (cons default (query-replace-read-from-suggestions)))
- (query-replace-read-from-suggestions))
- t)))))
- (to))
- (if (and (zerop (length from)) query-replace-defaults (not default))
- (cons (caar query-replace-defaults)
- (query-replace-compile-replacement
- (cdar query-replace-defaults) regexp-flag))
- (setq from (or (and (zerop (length from)) default)
- (query-replace--split-string from)))
- (when (consp from) (setq to (cdr from) from (car from)))
- (add-to-history query-replace-from-history-variable from nil t)
- ;; Warn if user types \n or \t, but don't reject the input.
- (and regexp-flag
- (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
- (let ((match (match-string 3 from)))
- (cond
- ((string= match "\\n")
- (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead"))
- ((string= match "\\t")
- (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB")))
- (sit-for 2)))
- (if (not to)
- from
- (add-to-history query-replace-to-history-variable to nil t)
- (add-to-history 'query-replace-defaults (cons from to) nil t)
- (cons from (query-replace-compile-replacement to regexp-flag)))))))
+ (let* ((history-add-new-input nil)
+ (separator-string
+ (when query-replace-from-to-separator
+ ;; Check if the first non-whitespace char is displayable
+ (if (char-displayable-p
+ (string-to-char (string-replace
+ " " "" query-replace-from-to-separator)))
+ query-replace-from-to-separator
+ " -> ")))
+ (separator
+ (when separator-string
+ (propertize separator-string
+ 'display separator-string
+ 'face 'minibuffer-prompt
+ 'separator t)))
+ (minibuffer-history
+ (append
+ (when separator
+ (mapcar (lambda (from-to)
+ (concat (query-replace-descr (car from-to))
+ separator
+ (query-replace-descr (cdr from-to))))
+ query-replace-defaults))
+ (symbol-value query-replace-from-history-variable)))
+ (minibuffer-allow-text-properties t) ; separator uses text-properties
+ (default (when (and query-replace-read-from-default (not regexp-flag))
+ (funcall query-replace-read-from-default)))
+ (prompt
+ (cond ((and query-replace-read-from-regexp-default regexp-flag) prompt)
+ (default (format-prompt prompt default))
+ ((and query-replace-defaults separator)
+ (format-prompt prompt (car minibuffer-history)))
+ (query-replace-defaults
+ (format-prompt
+ prompt (format "%s -> %s"
+ (query-replace-descr
+ (caar query-replace-defaults))
+ (query-replace-descr
+ (cdar query-replace-defaults)))))
+ (t (format-prompt prompt nil))))
+ (from
+ ;; The save-excursion here is in case the user marks and copies
+ ;; a region in order to specify the minibuffer input.
+ ;; That should not clobber the region for the query-replace itself.
+ (save-excursion
+ (minibuffer-with-setup-hook
+ (lambda ()
+ (setq-local text-property-default-nonsticky
+ (append '((separator . t) (face . t))
+ text-property-default-nonsticky)))
+ (if regexp-flag
+ (read-regexp
+ (if query-replace-read-from-regexp-default
+ (string-remove-suffix ": " prompt)
+ prompt)
+ query-replace-read-from-regexp-default
+ 'minibuffer-history)
+ (read-from-minibuffer
+ prompt nil nil nil nil
+ (if default
+ (delete-dups
+ (cons default (query-replace-read-from-suggestions)))
+ (query-replace-read-from-suggestions))
+ t)))))
+ (to))
+ (if (and (zerop (length from)) query-replace-defaults (not default))
+ (cons (caar query-replace-defaults)
+ (query-replace-compile-replacement
+ (cdar query-replace-defaults) regexp-flag))
+ (setq from (or (and (zerop (length from)) default)
+ (query-replace--split-string from)))
+ (when (consp from) (setq to (cdr from) from (car from)))
+ (add-to-history query-replace-from-history-variable from nil t)
+ ;; Warn if user types \n or \t, but don't reject the input.
+ (and regexp-flag
+ (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
+ (let ((match (match-string 3 from)))
+ (cond
+ ((string= match "\\n")
+ (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead"))
+ ((string= match "\\t")
+ (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB")))
+ (sit-for 2)))
+ (if (not to)
+ from
+ (add-to-history query-replace-to-history-variable to nil t)
+ (add-to-history 'query-replace-defaults (cons from to) nil t)
+ (cons from (query-replace-compile-replacement to regexp-flag))))))
(defun query-replace-compile-replacement (to regexp-flag)
"Maybe convert a regexp replacement TO to Lisp.