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

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

Re: How to return to the position from where I did tags-query-replace?


From: Emanuel Berg
Subject: Re: How to return to the position from where I did tags-query-replace?
Date: Sun, 04 Feb 2018 04:28:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Ambrose Laing wrote:

> I would like the same outcome as the original
> poster: I would like for tags-query-replace
> to always return to the position of the point
> when the command was invoked, except that
> I want it to happen programmatically.
> Here are two approaches I tried, neither of
> which works.

In general, I would do it like this.
Perhaps you can modify it so that instead of
applying `apply' to the args, put
`tags-query-replace' there and give the whole
thing the same interface as that function (also
change the name, of course).

This means you also have to change shortcuts to
invoke it instead of the original function.

With advice it can be set up completely
transparent if you care to read up on those...

(defun do-whatever-return (fun &rest args)
  (let ((point  (point))
        (buffer (current-buffer)) )
    (apply fun args)
    (when (bufferp buffer)
      (switch-to-buffer buffer)
      (goto-char (point) ))))
;; (do-whatever-return #'switch-to-buffer "*Help*")

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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