From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: emacs does not record the position at which it opened a file Date: Mon, 20 Apr 2015 22:21:30 +0600 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1429546981 21053 80.91.229.3 (20 Apr 2015 16:23:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Apr 2015 16:23:01 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: gnu ist Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 20 18:22:55 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YkETF-0003r1-F3 for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Apr 2015 18:22:53 +0200 Original-Received: from localhost ([::1]:54532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkETE-0001oB-Oo for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Apr 2015 12:22:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkESH-0000te-HB for help-gnu-emacs@gnu.org; Mon, 20 Apr 2015 12:21:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkESG-0006Ia-BM for help-gnu-emacs@gnu.org; Mon, 20 Apr 2015 12:21:53 -0400 Original-Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:32841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkESG-0006IO-1w for help-gnu-emacs@gnu.org; Mon, 20 Apr 2015 12:21:52 -0400 Original-Received: by lbbzk7 with SMTP id zk7so134835543lbb.0 for ; Mon, 20 Apr 2015 09:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=EWvyI5sqRUL5PCL18gPkInGSSQSMvaBWaDu4yAkCqQc=; b=v960VA/SBB2Ff5W76Z5Hb+TVxxYorsSiiE9Xf5LmWACifqBtCML1qIKB06kg/BG5lk Gqyw/ZcbwClWJcqW8yRqhkRWd24kSDkmA/NxgT3N69WnylMOAUMP9IagSwRNYISJ57lr FUDfrXKNl3uR9R361lZweRcege5Gp/NRnq/BpTAYf5u5Ul6dt4bzqgU/tMeLNF2NYNzB 8+KKsIcDXXU4Ie8D/pgHB6adnfUZLgLdUJqWf27NOauw6j6tgUrCCOZ7XonJWR611qrg Oyoc5bkHY1VDQSuZXisrrAO1gC+DjCBxq9Dc2Z6YrYXcF4ZdvSnL7shIcz6RAOmMYW7J aKYQ== X-Received: by 10.112.163.168 with SMTP id yj8mr16294252lbb.36.1429546911134; Mon, 20 Apr 2015 09:21:51 -0700 (PDT) Original-Received: by 10.25.43.65 with HTTP; Mon, 20 Apr 2015 09:21:30 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 4gN_UwSeTS5vR9OMvxXvXn7BkAo X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103887 Archived-At: On Mon, Apr 20, 2015 at 9:48 PM, gnu ist wrote: > yes, but you and others have not answered the question asked in the threa= d. > > what to put in .emacs so that when the file is opened, the position of th= e > 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 =E2=80=9CHow To Ask Questions The Smart Way=E2=80=9D by Eric S. Raymond. Re= turn 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 =E2=80=9Cset-mark-command=E2=80=9D, and = it sets mark at the current point position when invoked without a prefix argument =E2=80=94 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 =E2=80=9CStandard Hooks=E2=80=9D. You browse the lis= t and notice a hook called =E2=80=9Cfind-file-hook=E2=80=9D, with a cross-referen= ce to =E2=80=9CVisiting Functions=E2=80=9D. There, you read that the find-file-ho= ok is invoked whenever you visit a file. Also, following the =E2=80=9CSee Hooks=E2=80=9D link, you read that the pri= mary way to set a hook is by using the =E2=80=9Cadd-hook=E2=80=9D 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)