From: Yuri Khan <yuri.v.khan@gmail.com>
To: gnu ist <gnuist006@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 22:21:30 +0600 [thread overview]
Message-ID: <CAP_d_8XMyws-F+DvfB4Y=F3vjOBw4VzApw2PykM5dfkxGPf+Kg@mail.gmail.com> (raw)
In-Reply-To: <CAF=27p36fkUmCnSwr1c+5rFmnM88HSvMcY_qZMQj+oHF_7-H6g@mail.gmail.com>
On Mon, Apr 20, 2015 at 9:48 PM, gnu ist <gnuist006@gmail.com> wrote:
> yes, but you and others have not answered the question asked in the thread.
>
> what to put in .emacs so that when the file is opened, the position of the
> cursor is pushed onto the stack as if it was C-@
I may sound harsh but I do it for your own good: Please go and read
“How To Ask Questions The Smart Way” by Eric S. Raymond. Return here
after you have read and understood that document.
http://www.catb.org/esr/faqs/smart-questions.html
* * *
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. 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)
next prev parent reply other threads:[~2015-04-20 16:21 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 [this message]
2015-04-21 2:41 ` gnu ist
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='CAP_d_8XMyws-F+DvfB4Y=F3vjOBw4VzApw2PykM5dfkxGPf+Kg@mail.gmail.com' \
--to=yuri.v.khan@gmail.com \
--cc=gnuist006@gmail.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.