From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Proulx Newsgroups: gmane.emacs.help Subject: Re: $EDITOR to open at file end? Date: Fri, 6 Mar 2015 17:48:56 -0700 Message-ID: <20150306171620044258862@bob.proulx.com> References: <20150305002027882961376@bob.proulx.com> <87lhjbf0lj.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1425689354 22195 80.91.229.3 (7 Mar 2015 00:49:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Mar 2015 00:49:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 07 01:49:14 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 1YU2va-0004VP-3N for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Mar 2015 01:49:14 +0100 Original-Received: from localhost ([::1]:32827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU2vZ-00072d-1Y for geh-help-gnu-emacs@m.gmane.org; Fri, 06 Mar 2015 19:49:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU2vO-00072Y-KD for help-gnu-emacs@gnu.org; Fri, 06 Mar 2015 19:49:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YU2vL-0008ME-DH for help-gnu-emacs@gnu.org; Fri, 06 Mar 2015 19:49:02 -0500 Original-Received: from joseki.proulx.com ([216.17.153.58]:60195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YU2vL-0008M7-5W for help-gnu-emacs@gnu.org; Fri, 06 Mar 2015 19:48:59 -0500 Original-Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 7278721848 for ; Fri, 6 Mar 2015 17:48:56 -0700 (MST) Original-Received: by hysteria.proulx.com (Postfix, from userid 1000) id 54E0F2DC35; Fri, 6 Mar 2015 17:48:56 -0700 (MST) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87lhjbf0lj.fsf@debian.uxu> User-Agent: Mutt/1.5.23 (2014-03-12) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 216.17.153.58 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:103045 Archived-At: Emanuel Berg wrote: > Alexis writes: > >> Is there another way to instruct emacs explicitly > >> to open the file and go to the bottom of the file? > > > > Here's another possible kludge: > > > > $ emacs -Q --eval "(add-hook 'find-file-hook > > (lambda () (goto-char (point-max))))" > > > > :-) Thanks for the suggestion. However that -Q is a little harsh. And rewriting find-file so that every use of it thereafter jumps to the end of the file is double harsh. It does answer the question very literally however. Perhaps I should have clarified that everything else should remain normal. (chuckle) :-) > I think you can remove that smiley, because that is > exactly it (or one of many "exactly it" I should say), > only I got the impression that the OP wanted this for > opening a specific file, not every file, To avoid being vague I wanted this for an EDITOR setting for use with mutt when logging in over ssh to a remote server. This works. But the 999999 just feels like hack. In the .mutt/muttrc file: set editor="emacs +999999" > and besides he is likely to want his initialization intact (i.e., > not the -Q option which I suspected is a leftover from testing the > command). Right. Use of -Q is right out! :-) > So: > emacs FILE --eval "(goto-char (point-max))" Something like that sort'a works. It leads me to an acceptable answer. Obviously I was hoping to use a "string with options" followed by the filename in a configuration. This requires the configuration both before and after FILE. I can get there however by using a helper script. I will call it muttemacs and have it do something similar to this (written in compact form): #!/bin/sh test $# -ne 1 && { echo "Error: too many arguments" 1>&2; exit 1 ;} file=$1 exec emacs "$file" --eval "(goto-char (point-max))" > In situations like these it is common to say that it > is better to keep Emacs up all the time and open files > from, not with, Emacs. So, let me tell you that it is > better to keep Emacs up all the time and open files > from, not with, Emacs. :) I knew someone would suggest to use an emacs-server with emacsclient and screen/tmux and other types of suggestions. But I didn't know how to head that off. Yes I am very much aware of them. I almost always run emacs inside of a screen session already. I know I can set up to automatically switch screen windows to the running emacs server window. All old stuff. But that has nothing to do with wanting this setup. Doing that just doesn't make sense in the way I need it to work. I hadn't mentioned mutt before for fear people would suggest running gnus or emacs-vm instead. But in the end we all like what we like. And as an fyi heads up to anyone that cares I am losing network connectivity to my servers in the next two weeks. Everything needs to pick up and move elsewhere. Which is why I am making these changes. It is causing me to rework much of the way I do things. I am trying to keep ahead of things and to remain functional through the upcoming disruption. Bob