unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nathaniel Flath <flat0103@gmail.com>
To: emacs-devel@gnu.org
Subject: occur patch
Date: Wed, 10 Nov 2010 20:44:39 -0800	[thread overview]
Message-ID: <AANLkTin-UY1dDcEC2-1XJ-R8WMPmuX-YYpcjW2jioU6E@mail.gmail.com> (raw)

Hello,
I found it useful to have occur default to the current word instead of
the last regexp, so I modified replace.el to support this.  The patch
is below, if it should be installed into emacs itself - let me know of
any issues.

Thanks,
Nathaniel Flath

diff --git a/lisp/replace.el b/lisp/replace.el
index baea282..12c95cf 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1006,9 +1006,17 @@ which means to discard all text properties."
   :group 'matching
   :version "22.1")

+(defcustom occur-read-method 'history
+  "Method that Occur uses to prompt for a regex."
+  :type '(choice (const :tag "Last regex" 'history)
+		 (const :tag "Current word" 'current-word))
+  :group 'matching)
+
 (defun occur-read-primary-args ()
   (list (read-regexp "List lines matching regexp"
-		     (car regexp-history))
+		     (if (eq occur-read-method 'history)
+			 (car regexp-history)
+		       (current-word)))
 	(when current-prefix-arg
 	  (prefix-numeric-value current-prefix-arg))))



             reply	other threads:[~2010-11-11  4:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11  4:44 Nathaniel Flath [this message]
2010-11-11  7:30 ` occur patch Geoff Gole
2010-11-11 20:10 ` Stefan Monnier
2010-11-14 22:19   ` Juri Linkov

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=AANLkTin-UY1dDcEC2-1XJ-R8WMPmuX-YYpcjW2jioU6E@mail.gmail.com \
    --to=flat0103@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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).