help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: command-history-repeat used with query-search


From: Alan
Subject: Re: command-history-repeat used with query-search
Date: Sun, 3 Mar 2013 09:09:04 -0800 (PST)
User-agent: G2/1.0

One line of code needed changing.  In place of
    (when (featurep 'edebug)
put
    (when (and (featurep 'edebug) (functionp '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
> 
> > 
> 
> > >
> 
> > 
> 
> > 
> 
> > 
> 
> > --




reply via email to

[Prev in Thread] Current Thread [Next in Thread]