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: Sun, 3 Mar 2013 09:36:47 -0800 (PST) Message-ID: References: <0c1caef0-99ef-4413-b7f0-a178fea27d2f@googlegroups.com> <29196f95-71ab-4e31-bc61-eefbbb6536a0@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 1362332996 1220 80.91.229.3 (3 Mar 2013 17:49:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Mar 2013 17:49:56 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Alan To: gnu.emacs.help@googlegroups.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 03 18:50:20 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 1UCD3D-0007nf-3J for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Mar 2013 18:50:19 +0100 Original-Received: from localhost ([::1]:50371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCD2r-0000qy-QE for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Mar 2013 12:49:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCCqB-0004g6-Sk for help-gnu-emacs@gnu.org; Sun, 03 Mar 2013 12:36:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCCq9-0000Qz-8S for help-gnu-emacs@gnu.org; Sun, 03 Mar 2013 12:36:51 -0500 Original-Received: from mail-ob0-x23f.google.com ([2607:f8b0:4003:c01::23f]:42960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCCq9-0000Qr-31 for help-gnu-emacs@gnu.org; Sun, 03 Mar 2013 12:36:49 -0500 Original-Received: by mail-ob0-f191.google.com with SMTP id dn14so581690obc.18 for ; Sun, 03 Mar 2013 09:36:48 -0800 (PST) X-Received: by 10.50.186.202 with SMTP id fm10mr74339igc.10.1362332208102; Sun, 03 Mar 2013 09:36:48 -0800 (PST) Original-Path: glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <29196f95-71ab-4e31-bc61-eefbbb6536a0@googlegroups.com> 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 X-Google-Web-Client: true X-Google-IP: 108.89.145.141 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::23f X-Mailman-Approved-At: Sun, 03 Mar 2013 12:49:16 -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:89329 Archived-At: One line of code needed changing. It was (when (featurep 'edebug) and it becomes (when (and (featurep 'edebug) (boundp 'edebug-function)) On Saturday, March 2, 2013 10:43:51 PM UTC-6, Alan wrote: > 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" i= n XEmacs (but I'm not including that code here). >=20 >=20 >=20 > (defun command-history-repeat () >=20 > "Repeat the command shown on the current line. >=20 > The buffer for that command is the previous current buffer. >=20 > If a query command, operate in the previous current buffer" >=20 > (interactive) >=20 > (let ((aw-cmd-buf (current-buffer)) >=20 > (aw-buf-list (buffer-list)) >=20 > aw-edit-buf aw-query aw-cmd-str aw-m1 >=20 > aw-edebug-data aw-edebug-def-mark aw-edebug-buffer) >=20 > ;; running edebug results in the code buffer being present in (buffer= -list), so delete that buffer from the >=20 > ;; list that we actually use >=20 > (when (featurep 'edebug) >=20 > (setq aw-edebug-data (get edebug-function 'edebug) >=20 > aw-edebug-def-mark (car aw-edebug-data) >=20 > aw-edebug-buffer (marker-buffer aw-edebug-def-mark))) >=20 > ;;(delq (get-buffer "chist-fix.el") aw-buf-list) >=20 > (delq aw-edebug-buffer aw-buf-list) >=20 > (setq aw-edit-buf (car (cdr aw-buf-list))) >=20 > (save-excursion >=20 > (beginning-of-line) >=20 > (setq aw-m1 (point)) >=20 > (forward-sexp) >=20 > (setq aw-cmd-str (buffer-substring aw-m1 (point))) >=20 > (setq aw-query (string-match "query" aw-cmd-str))) >=20 > (cond >=20 > ((not aw-query) >=20 > (save-excursion >=20 > (eval (prog1 (read aw-cmd-str) >=20 > (set-buffer aw-edit-buf))))) >=20 > ;; >=20 > (aw-query >=20 > (pop-to-buffer aw-edit-buf) >=20 > (eval (prog1 (read aw-cmd-str) >=20 > (set-buffer aw-edit-buf))) >=20 > (pop-to-buffer aw-cmd-buf))))) >=20 >=20 >=20 > On Saturday, March 2, 2013 1:49:16 AM UTC-6, Jambunathan K wrote: >=20 > > Did you mean to show us the modified code? If yes, then you forgot to >=20 > >=20 >=20 > > attach it. >=20 > >=20 >=20 > >=20 >=20 > >=20 >=20 > > Alan writes: >=20 > >=20 >=20 > >=20 >=20 > >=20 >=20 > > > I was frustrated that when I wanted to repeat use of "query-search" i= n >=20 > >=20 >=20 > > > a buffer, using "list-command-history" and "command-history-repeat" >=20 > >=20 >=20 > > > (bound to "x"), I wasn't able to watch the stepping through the buffe= r >=20 > >=20 >=20 > > > of interest, being asked each time if I wished to make the >=20 > >=20 >=20 > > > substitution and seeing the line of code that I was being queried >=20 > >=20 >=20 > > > about. >=20 > >=20 >=20 > > > >=20 > >=20 >=20 > > > I decided to modify function "command-history-repeat" so that I could >=20 > >=20 >=20 > > > watch "query-search" operate. My elisp skills needed some exercise, >=20 > >=20 >=20 > > > so I did so. >=20 > >=20 >=20 > > > >=20 > >=20 >=20 > > > After writing the modified code, I did a search to see if anyone else >=20 > >=20 >=20 > > > had done something similar. I didn't find anything. Please comment >=20 > >=20 >=20 > > > if I overlooked something. >=20 > >=20 >=20 > > > >=20 > >=20 >=20 > > > I am using >=20 > >=20 >=20 > > > >=20 > >=20 >=20 > > > GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-08-28 on MARVIN >=20 > >=20 >=20 > > > >=20 > >=20 >=20 > >=20 >=20 > >=20 >=20 > > --