emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/replace.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/replace.el
Date: Mon, 05 Jul 2004 18:53:23 -0400

Index: emacs/lisp/replace.el
diff -c emacs/lisp/replace.el:1.180 emacs/lisp/replace.el:1.181
*** emacs/lisp/replace.el:1.180 Sat Jul  3 05:18:38 2004
--- emacs/lisp/replace.el       Mon Jul  5 22:50:46 2004
***************
*** 36,50 ****
  
  (defvar query-replace-history nil)
  
! (defcustom query-replace-interactive nil
    "Non-nil means `query-replace' uses the last search string.
! That becomes the \"string to replace\".
! If value is `initial', the last search string is inserted into
! the minibuffer as an initial value for \"string to replace\"."
!   :type '(choice (const :tag "Off" nil)
!                  (const :tag "Initial content" initial)
!                  (other :tag "Use default value" t))
!   :group 'matching)
  
  (defcustom query-replace-from-history-variable 'query-replace-history
    "History list to use for the FROM argument of `query-replace' commands.
--- 36,44 ----
  
  (defvar query-replace-history nil)
  
! (defvar query-replace-interactive nil
    "Non-nil means `query-replace' uses the last search string.
! That becomes the \"string to replace\".")
  
  (defcustom query-replace-from-history-variable 'query-replace-history
    "History list to use for the FROM argument of `query-replace' commands.
***************
*** 74,81 ****
    (unless noerror
      (barf-if-buffer-read-only))
    (let (from to)
!     (if (and query-replace-interactive
!              (not (eq query-replace-interactive 'initial)))
          (setq from (car (if regexp-flag regexp-search-ring search-ring)))
        ;; The save-excursion here is in case the user marks and copies
        ;; a region in order to specify the minibuffer input.
--- 68,74 ----
    (unless noerror
      (barf-if-buffer-read-only))
    (let (from to)
!     (if query-replace-interactive
          (setq from (car (if regexp-flag regexp-search-ring search-ring)))
        ;; The save-excursion here is in case the user marks and copies
        ;; a region in order to specify the minibuffer input.
***************
*** 83,91 ****
        (save-excursion
          (setq from (read-from-minibuffer
                      (format "%s: " string)
!                     (if (eq query-replace-interactive 'initial)
!                         (car (if regexp-flag regexp-search-ring search-ring)))
!                     nil nil
                      query-replace-from-history-variable
                      nil t)))
        ;; Warn if user types \n or \t, but don't reject the input.
--- 76,82 ----
        (save-excursion
          (setq from (read-from-minibuffer
                      (format "%s: " string)
!                     nil nil nil
                      query-replace-from-history-variable
                      nil t)))
        ;; Warn if user types \n or \t, but don't reject the input.
***************
*** 269,284 ****
  only matches that are surrounded by word boundaries.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let (from to)
!      (if query-replace-interactive
!          (setq from (car regexp-search-ring))
!        (setq from (read-from-minibuffer "Query replace regexp: "
!                                         nil nil nil
!                                         query-replace-from-history-variable
!                                         nil t)))
!      (setq to (list (read-from-minibuffer
!                      (format "Query replace regexp %s with eval: " from)
!                      nil nil t query-replace-to-history-variable from t)))
       ;; We make TO a list because replace-match-string-symbols requires one,
       ;; and the user might enter a single token.
       (replace-match-string-symbols to)
--- 260,274 ----
  only matches that are surrounded by word boundaries.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let* ((from (if query-replace-interactive
!                   (car regexp-search-ring)
!                 (read-from-minibuffer "Query replace regexp: "
!                                       nil nil nil
!                                       query-replace-from-history-variable
!                                       nil t)))
!         (to (list (read-from-minibuffer
!                    (format "Query replace regexp %s with eval: " from)
!                    nil nil t query-replace-to-history-variable from t))))
       ;; We make TO a list because replace-match-string-symbols requires one,
       ;; and the user might enter a single token.
       (replace-match-string-symbols to)
***************
*** 311,327 ****
  before rotating to the next.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let (from to)
!      (setq from (if query-replace-interactive
                    (car regexp-search-ring)
                  (read-from-minibuffer "Map query replace (regexp): "
                                        nil nil nil
                                        'query-replace-history nil t)))
!      (setq to (read-from-minibuffer
               (format "Query replace %s with (space-separated strings): "
                       from)
               nil nil nil
!              'query-replace-history from t))
       (list from to
           (and current-prefix-arg
                (prefix-numeric-value current-prefix-arg))
--- 301,316 ----
  before rotating to the next.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let* ((from (if query-replace-interactive
                    (car regexp-search-ring)
                  (read-from-minibuffer "Map query replace (regexp): "
                                        nil nil nil
                                        'query-replace-history nil t)))
!         (to (read-from-minibuffer
               (format "Query replace %s with (space-separated strings): "
                       from)
               nil nil nil
!              'query-replace-history from t)))
       (list from to
           (and current-prefix-arg
                (prefix-numeric-value current-prefix-arg))
***************
*** 925,931 ****
          (let ((matches 0)     ;; count of matched lines
                (lines 1)       ;; line count
                (matchbeg 0)
-               (matchend 0)
                (origpt nil)
                (begpt nil)
                (endpt nil)
--- 914,919 ----
***************
*** 945,952 ****
                  (setq origpt (point))
                  (when (setq endpt (re-search-forward regexp nil t))
                    (setq matches (1+ matches)) ;; increment match count
!                   (setq matchbeg (match-beginning 0)
!                         matchend (match-end 0))
                    (setq begpt (save-excursion
                                  (goto-char matchbeg)
                                  (line-beginning-position)))
--- 933,939 ----
                  (setq origpt (point))
                  (when (setq endpt (re-search-forward regexp nil t))
                    (setq matches (1+ matches)) ;; increment match count
!                   (setq matchbeg (match-beginning 0))
                    (setq begpt (save-excursion
                                  (goto-char matchbeg)
                                  (line-beginning-position)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]