all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan <wehmann@fnal.gov>
To: gnu.emacs.help@googlegroups.com
Cc: help-gnu-emacs@gnu.org, Alan <wehmann@fnal.gov>
Subject: Re: command-history-repeat used with query-search
Date: Sun, 3 Mar 2013 09:36:47 -0800 (PST)	[thread overview]
Message-ID: <cf4fec3d-7bba-4c00-9143-ab09babfa6e8@googlegroups.com> (raw)
In-Reply-To: <29196f95-71ab-4e31-bc61-eefbbb6536a0@googlegroups.com>

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" 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-list), so delete that buffer from the
> 
>     ;; 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
> 
>      ((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)))))
> 
> 
> 
> 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
> 
> > 
> 
> > attach it.
> 
> > 
> 
> > 
> 
> > 
> 
> > Alan writes:
> 
> > 
> 
> > 
> 
> > 
> 
> > > I was frustrated that when I wanted to repeat use of "query-search" in
> 
> > 
> 
> > > a buffer, using "list-command-history" and "command-history-repeat"
> 
> > 
> 
> > > (bound to "x"), I wasn't able to watch the stepping through the buffer
> 
> > 
> 
> > > of interest, being asked each time if I wished to make the
> 
> > 
> 
> > > substitution and seeing the line of code that I was being queried
> 
> > 
> 
> > > about.
> 
> > 
> 
> > >
> 
> > 
> 
> > > I decided to modify function "command-history-repeat" so that I could
> 
> > 
> 
> > > watch "query-search" operate.  My elisp skills needed some exercise,
> 
> > 
> 
> > > so I did so.
> 
> > 
> 
> > >
> 
> > 
> 
> > > After writing the modified code, I did a search to see if anyone else
> 
> > 
> 
> > > had done something similar.  I didn't find anything.  Please comment
> 
> > 
> 
> > > if I overlooked something.
> 
> > 
> 
> > >
> 
> > 
> 
> > > I am using
> 
> > 
> 
> > >
> 
> > 
> 
> > > GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-08-28 on MARVIN
> 
> > 
> 
> > >
> 
> > 
> 
> > 
> 
> > 
> 
> > --




      parent reply	other threads:[~2013-03-03 17:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 22:53 command-history-repeat used with query-search Alan
2013-03-02  7:49 ` Jambunathan K
     [not found] ` <mailman.21241.1362210582.855.help-gnu-emacs@gnu.org>
2013-03-02 19:20   ` Alan
2013-03-03  4:43   ` Alan
2013-03-03 17:09     ` Alan
2013-03-03 17:36     ` Alan [this message]

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

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

  git send-email \
    --in-reply-to=cf4fec3d-7bba-4c00-9143-ab09babfa6e8@googlegroups.com \
    --to=wehmann@fnal.gov \
    --cc=gnu.emacs.help@googlegroups.com \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.