all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <moasen@zoho.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to return to the position from where I did tags-query-replace?
Date: Sun, 04 Feb 2018 04:28:02 +0100	[thread overview]
Message-ID: <86d11lxwl9.fsf@zoho.com> (raw)
In-Reply-To: 2f9fe1c0-f382-47d4-8df2-0b39d3645385@googlegroups.com

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	other threads:[~2018-02-04  3:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-05 18:33 How to return to the position from where I did tags-query-replace? Yevgeniy Makarov
2007-09-05 21:41 ` Eric Hanchrow
     [not found] ` <mailman.388.1189029337.18990.help-gnu-emacs@gnu.org>
2018-02-03 22:27   ` Ambrose Laing
2018-02-04  3:28     ` Emanuel Berg [this message]
2018-02-04  4:30       ` Emanuel Berg
2018-02-04  4:34         ` Emanuel Berg
2018-02-04  4:46         ` Emanuel Berg
2018-02-04 20:14           ` aklaing
2018-02-04 20:25             ` Emanuel Berg
2018-02-04 20:36               ` Emanuel Berg
2018-02-04 20:37               ` aklaing
2018-02-04 20:41                 ` Emanuel Berg
2018-02-04 20:52                   ` aklaing
2018-02-04 21:02                     ` Emanuel Berg
2018-02-04 20:29             ` aklaing
2018-02-04 20:38               ` Emanuel Berg

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=86d11lxwl9.fsf@zoho.com \
    --to=moasen@zoho.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.