From: gnu ist <gnuist006@gmail.com>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: emacs does not record the position at which it opened a file
Date: Mon, 20 Apr 2015 19:41:34 -0700 [thread overview]
Message-ID: <CAF=27p2Kn4hTiZt=sSGChqtjJFgPT66N6cyQEEg+4hCnwQrshw@mail.gmail.com> (raw)
In-Reply-To: <CAP_d_8XMyws-F+DvfB4Y=F3vjOBw4VzApw2PykM5dfkxGPf+Kg@mail.gmail.com>
On Mon, Apr 20, 2015 at 9:21 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> The C-@ key is by default bound to “set-mark-command”, and it sets
> mark at the current point position when invoked without a prefix
> argument — i.e. (set-mark-command nil). It looks like you already
> found that out, and tried adding that to your init file.
>
> But it did not work, because you want to invoke that after you visit a
> file, not when you start Emacs.
In the old emacs version where it works the way I am trying to
emulate, I see that if I roam around in the *scratch* buffer and try
to return to the original location by C-u C-SPC, it does not return,
so you are correct that it must work only when I visit a file, not for
*scratch*. I did not anticipate this fine distinction.
> Opening the Elisp manual, you find a
> node promisingly named “Standard Hooks”. You browse the list and
> notice a hook called “find-file-hook”, with a cross-reference to
> “Visiting Functions”. There, you read that the find-file-hook is
> invoked whenever you visit a file.
> Also, following the “See Hooks” link, you read that the primary way to
> set a hook is by using the “add-hook” function.
>
> So, the following incantations will do what you ask (but not
> necessarily what you want or need).
>
> (defun my-find-file-hook () (set-mark-command nil))
> (add-hook 'find-file-hook 'my-find-file-hook)
I have tried this and it seems to work in that it remembers the
position where the .emacs_places puts the cursor if I move it around.
There are still two problems. It has both the beginning of the file
and the current place on the stack and the region between them as
highlighted. I have to press C-g to get rid of it. Also, the mark ring
is not consistent. It appears that sometimes, if I open the file
twice, it has the mark at the beginning of the file and has
highlighted the traverse from there to the position in .emacs_places.
What I may need is a method to examine the mark ring for which I could
not locate a command. This would help me debug the problem.
thanks for any guidance.
next prev parent reply other threads:[~2015-04-21 2:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-20 0:19 emacs does not record the position at which it opened a file gnuist006
2015-04-20 1:18 ` Alexis
2015-04-20 1:46 ` Dale Snell
[not found] ` <mailman.1141.1429492704.904.help-gnu-emacs@gnu.org>
2015-04-20 6:52 ` gnuist006
2015-04-20 11:52 ` Yuri Khan
2015-04-20 15:48 ` gnu ist
2015-04-20 16:21 ` Yuri Khan
2015-04-21 2:41 ` gnu ist [this message]
2015-04-21 12:53 ` Stefan Monnier
[not found] ` <mailman.1189.1429544936.904.help-gnu-emacs@gnu.org>
2015-04-20 22:34 ` Barry Margolin
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='CAF=27p2Kn4hTiZt=sSGChqtjJFgPT66N6cyQEEg+4hCnwQrshw@mail.gmail.com' \
--to=gnuist006@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=yuri.v.khan@gmail.com \
/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.