emacs-devel
[Top][All Lists]
Advanced

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

Tiny change to find-tag-default.


From: Kim F. Storm
Subject: Tiny change to find-tag-default.
Date: Fri, 21 Jul 2006 11:53:23 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

The following way of working seems natural to me -- but doesn't work.
[I have transient-mark-mode == t]


Suppose I'm looking at a text, and want to grep for a phrase
(e.g. just two words) in that text, I highlight the text to search for
(set mark, go to end of text) and do M-x lgrep.

However, this ignores my selection, and just suggests the word at point
at the regexp.

The following patch changes that to DTRT (IMO):


I don't think it makes sense to do this w/o transient-mark-mode,
but that's why we have temporary transient-mark-mode marking.


Index: subr.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/subr.el,v
retrieving revision 1.521
diff -b -c -r1.521 subr.el
*** subr.el     18 Jul 2006 01:34:48 -0000      1.521
--- subr.el     21 Jul 2006 09:47:53 -0000
***************
*** 1993,1998 ****
--- 1993,2001 ----
  (defun find-tag-default ()
    "Determine default tag to search for, based on text at point.
  If there is no plausible default, return nil."
+   (if (and transient-mark-mode
+          mark-active)
+       (buffer-substring-no-properties (point) (mark))
      (save-excursion
        (while (looking-at "\\sw\\|\\s_")
        (forward-char 1))
***************
*** 2012,2018 ****
                        (forward-char 1))
                      (point)))
            (error nil)))
!       nil)))
  
  (defun play-sound (sound)
    "SOUND is a list of the form `(sound KEYWORD VALUE...)'.
--- 2015,2021 ----
                          (forward-char 1))
                        (point)))
              (error nil)))
!       nil))))
  
  (defun play-sound (sound)
    "SOUND is a list of the form `(sound KEYWORD VALUE...)'.

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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