From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nathaniel Flath Newsgroups: gmane.emacs.devel Subject: occur patch Date: Wed, 10 Nov 2010 20:44:39 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1289450695 15643 80.91.229.12 (11 Nov 2010 04:44:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 11 Nov 2010 04:44:55 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 11 05:44:52 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PGP1n-0006fe-UM for ged-emacs-devel@m.gmane.org; Thu, 11 Nov 2010 05:44:52 +0100 Original-Received: from localhost ([127.0.0.1]:33452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGP1i-0003by-4R for ged-emacs-devel@m.gmane.org; Wed, 10 Nov 2010 23:44:46 -0500 Original-Received: from [140.186.70.92] (port=35572 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGP1d-0003bt-Pp for emacs-devel@gnu.org; Wed, 10 Nov 2010 23:44:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGP1c-0001pT-St for emacs-devel@gnu.org; Wed, 10 Nov 2010 23:44:41 -0500 Original-Received: from mail-qy0-f169.google.com ([209.85.216.169]:36780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGP1c-0001pL-Ok for emacs-devel@gnu.org; Wed, 10 Nov 2010 23:44:40 -0500 Original-Received: by qyk1 with SMTP id 1so834136qyk.0 for ; Wed, 10 Nov 2010 20:44:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=1bFWHx6xQTTQ6QfH7CTzB2b8zRHKMbUlfmsGPpvP4xg=; b=M7QKCiF636fBsEO3m7W1tycG7ucfXC5INL1Z5El7/gsWCm53E2PmxiHjYhU/jb7ku5 0Sh5sWorR1B7Nmjz/ZNKL5QbkQ3UM+Aqj74SVZFb1IJ/H9SLoltmf6wous885etYXvKd xIaWmE9psuTZq1EXJQkmfV7dOtbg5LXyEsZd0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ZxqBn26T59HY4EV+aA/A2f7HoZr+AZ/Xu4Jx5wnJ96PlossPF2MJ8BmM88ay4/6I1D nOrhGU3gB9NV43y6vicriTDDo5g18m+e2dcnBal6p53dYcOfjdLiwu7lgDoOIvB4PBtk 0R5ggD3oK/SGcLvXiRKTVcqmy8fIxUByipork= Original-Received: by 10.229.224.81 with SMTP id in17mr377801qcb.81.1289450679968; Wed, 10 Nov 2010 20:44:39 -0800 (PST) Original-Received: by 10.220.67.75 with HTTP; Wed, 10 Nov 2010 20:44:39 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:132534 Archived-At: 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))))