From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Newsgroups: gmane.emacs.help Subject: Re: command-history-repeat used with query-search Date: Sat, 2 Mar 2013 11:20:08 -0800 (PST) Message-ID: References: <0c1caef0-99ef-4413-b7f0-a178fea27d2f@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362264372 2742 80.91.229.3 (2 Mar 2013 22:46:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Mar 2013 22:46:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Alan To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 02 23:46:36 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UBvCN-0002Ic-VG for geh-help-gnu-emacs@m.gmane.org; Sat, 02 Mar 2013 23:46:36 +0100 Original-Received: from localhost ([::1]:41806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBvC2-0001la-Nw for geh-help-gnu-emacs@m.gmane.org; Sat, 02 Mar 2013 17:46:14 -0500 X-Received: by 10.224.185.201 with SMTP id cp9mr13207632qab.6.1362252009164; Sat, 02 Mar 2013 11:20:09 -0800 (PST) X-Received: by 10.49.30.100 with SMTP id r4mr1607786qeh.32.1362252009031; Sat, 02 Mar 2013 11:20:09 -0800 (PST) Original-Path: usenet.stanford.edu!dd2no4430149qab.0!news-out.google.com!q17ni135qal.0!nntp.google.com!t2no6298243qal.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=108.89.145.141; posting-account=czAMxQoAAAAUEojshw4CrIvcwSdulymE Original-NNTP-Posting-Host: 108.89.145.141 User-Agent: G2/1.0 Injection-Date: Sat, 02 Mar 2013 19:20:09 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:197036 X-Mailman-Approved-At: Sat, 02 Mar 2013 17:45:43 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89320 Archived-At: On Saturday, March 2, 2013 1:49:16 AM UTC-6, Jambunathan K wrote: > Did you mean to show us the modified code? If yes, then you forgot to >=20 > attach it. >=20 >=20 >=20 > Alan writes: >=20 >=20 >=20 > > I was frustrated that when I wanted to repeat use of "query-search" in >=20 > > a buffer, using "list-command-history" and "command-history-repeat" >=20 > > (bound to "x"), I wasn't able to watch the stepping through the buffer >=20 > > of interest, being asked each time if I wished to make the >=20 > > substitution and seeing the line of code that I was being queried >=20 > > about. >=20 > > >=20 > > I decided to modify function "command-history-repeat" so that I could >=20 > > watch "query-search" operate. My elisp skills needed some exercise, >=20 > > so I did so. >=20 > > >=20 > > After writing the modified code, I did a search to see if anyone else >=20 > > had done something similar. I didn't find anything. Please comment >=20 > > if I overlooked something. >=20 > > >=20 > > I am using >=20 > > >=20 > > GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-08-28 on MARVIN >=20 > > >=20 >=20 >=20 > -- Although I intentionally did not include the code earlier, I'll do so now (= it's been improved a bit since I started this topic). In a similar vein, I= 've modified the operation of "occur" so that it can use "word-at-point" to= define the default--following the example of what happens with "occur" in = XEmacs (but I'm not including that code here). (defun command-history-repeat () "Repeat the command shown on the current line. The buffer for that command is the previous current buffer. If a query command, operate in the previous current buffer" (interactive) (let ((aw-cmd-buf (current-buffer)) (aw-buf-list (buffer-list)) aw-edit-buf aw-query aw-cmd-str aw-m1 aw-edebug-data aw-edebug-def-mark aw-edebug-buffer) ;; running edebug results in the code buffer being present in (buffer-l= ist), so delete that buffer from the=20 ;; list that we actually use (when (featurep 'edebug) (setq aw-edebug-data (get edebug-function 'edebug) aw-edebug-def-mark (car aw-edebug-data) aw-edebug-buffer (marker-buffer aw-edebug-def-mark))) ;;(delq (get-buffer "chist-fix.el") aw-buf-list) (delq aw-edebug-buffer aw-buf-list) (setq aw-edit-buf (car (cdr aw-buf-list))) (save-excursion (beginning-of-line) (setq aw-m1 (point)) (forward-sexp) (setq aw-cmd-str (buffer-substring aw-m1 (point))) (setq aw-query (string-match "query" aw-cmd-str))) (cond=20 ((not aw-query) (save-excursion (eval (prog1 (read aw-cmd-str) (set-buffer aw-edit-buf))))) ;; (aw-query (pop-to-buffer aw-edit-buf) (eval (prog1 (read aw-cmd-str) (set-buffer aw-edit-buf))) (pop-to-buffer aw-cmd-buf)))))