unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* command-history-repeat used with query-search
@ 2013-03-01 22:53 Alan
  2013-03-02  7:49 ` Jambunathan K
       [not found] ` <mailman.21241.1362210582.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Alan @ 2013-03-01 22:53 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: command-history-repeat used with query-search
  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>
  1 sibling, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2013-03-02  7:49 UTC (permalink / raw)
  To: Alan; +Cc: help-gnu-emacs


Did you mean to show us the modified code?  If yes, then you forgot to
attach it.

Alan <wehmann@fnal.gov> 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
>

-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: command-history-repeat used with query-search
       [not found] ` <mailman.21241.1362210582.855.help-gnu-emacs@gnu.org>
@ 2013-03-02 19:20   ` Alan
  2013-03-03  4:43   ` Alan
  1 sibling, 0 replies; 6+ messages in thread
From: Alan @ 2013-03-02 19:20 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-gnu-emacs, Alan

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
> 
> >
> 
> 
> 
> --

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)))))


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: command-history-repeat used with query-search
       [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
  1 sibling, 2 replies; 6+ messages in thread
From: Alan @ 2013-03-03  4:43 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-gnu-emacs, Alan

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
> 
> >
> 
> 
> 
> --



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: command-history-repeat used with query-search
  2013-03-03  4:43   ` Alan
@ 2013-03-03 17:09     ` Alan
  2013-03-03 17:36     ` Alan
  1 sibling, 0 replies; 6+ messages in thread
From: Alan @ 2013-03-03 17:09 UTC (permalink / raw)
  To: gnu.emacs.help; +Cc: help-gnu-emacs, Alan

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
> 
> > 
> 
> > >
> 
> > 
> 
> > 
> 
> > 
> 
> > --




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: command-history-repeat used with query-search
  2013-03-03  4:43   ` Alan
  2013-03-03 17:09     ` Alan
@ 2013-03-03 17:36     ` Alan
  1 sibling, 0 replies; 6+ messages in thread
From: Alan @ 2013-03-03 17:36 UTC (permalink / raw)
  To: gnu.emacs.help; +Cc: help-gnu-emacs, Alan

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
> 
> > 
> 
> > >
> 
> > 
> 
> > 
> 
> > 
> 
> > --




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-03 17:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).