unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Subject: Tiny change to find-tag-default.
Date: Fri, 21 Jul 2006 11:53:23 +0200	[thread overview]
Message-ID: <m3k667jncc.fsf@kfs-l.imdomain.dk> (raw)


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 <storm@cua.dk> http://www.cua.dk

             reply	other threads:[~2006-07-21  9:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-21  9:53 Kim F. Storm [this message]
2006-07-21 14:18 ` Tiny change to find-tag-default Drew Adams
2006-07-21 22:21   ` Kim F. Storm
2006-07-21 23:15     ` Drew Adams
2006-07-22  4:39 ` Richard Stallman
2006-07-22 12:17   ` martin rudalics
2006-07-23 17:34     ` Richard Stallman
2006-07-28 23:06       ` Kim F. Storm
2006-07-28  0:09     ` Kim F. Storm
2006-07-28  9:12       ` martin rudalics
2006-07-28 23:04 ` Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k667jncc.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).