From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: gnu ist Newsgroups: gmane.emacs.help Subject: Re: emacs does not record the position at which it opened a file Date: Mon, 20 Apr 2015 19:41:34 -0700 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 1429584111 5899 80.91.229.3 (21 Apr 2015 02:41:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Apr 2015 02:41:51 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 21 04:41:51 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 1YkO8E-0007C8-Rt for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Apr 2015 04:41:50 +0200 Original-Received: from localhost ([::1]:56019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkO8D-0007si-NU for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Apr 2015 22:41:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkO82-0007sX-Qt for help-gnu-emacs@gnu.org; Mon, 20 Apr 2015 22:41:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkO7z-0005D0-7n for help-gnu-emacs@gnu.org; Mon, 20 Apr 2015 22:41:38 -0400 Original-Received: from mail-oi0-x233.google.com ([2607:f8b0:4003:c06::233]:33870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkO7z-0005Cw-2C for help-gnu-emacs@gnu.org; Mon, 20 Apr 2015 22:41:35 -0400 Original-Received: by oiko83 with SMTP id o83so141785857oik.1 for ; Mon, 20 Apr 2015 19:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=m7WqD0+RwsYOs9rBwIDPOUGjEuBgBldGuzkCg6tWZQE=; b=JwzfFlQJ6fGuCkymMUKMxyjprI38k4+ov3lkEJx8v4GWBnFs1FVkHAyvNQFU0obYhr dGqueQ7tljFj2UnLHNOXFJhd/7/GdKA2Nc7Y8XJT+KDcWEQvvVWViQDUBbSiTnGkXn0I PhI+/QKu0ZRpggAK5ne4dz7FW1pkctrx+pap3pqEJFq9zvQTyEqnrOBMdmcgcqnCvjH2 mS2bwsp7yCKOZpxxMg1lmymRUiYHAS37jG23CZKpU4XAp1uBvIR8qItzg8iLUMO8dqYS 4KruinR1lUA+8Hc1+gtFExqIjPwVvf+a0Vsdok/GCFxhCXt/xBmLqI83PcFBReu/edcU NrEg== X-Received: by 10.202.49.77 with SMTP id x74mr16289578oix.86.1429584094436; Mon, 20 Apr 2015 19:41:34 -0700 (PDT) Original-Received: by 10.182.21.204 with HTTP; Mon, 20 Apr 2015 19:41:34 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::233 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:103894 Archived-At: On Mon, Apr 20, 2015 at 9:21 AM, Yuri Khan wrote: > The C-@ key is by default bound to =E2=80=9Cset-mark-command=E2=80=9D, an= d 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. 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 =E2=80=9CStandard Hooks=E2=80=9D. You browse the l= ist and > notice a hook called =E2=80=9Cfind-file-hook=E2=80=9D, with a cross-refer= ence to > =E2=80=9CVisiting Functions=E2=80=9D. There, you read that the find-file-= hook is > invoked whenever you visit a file. > Also, following the =E2=80=9CSee Hooks=E2=80=9D link, you read that the p= rimary 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) 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.