From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: xz Newsgroups: gmane.emacs.help Subject: Re: How to go to next line on the screen instead of going to next line in the text? Date: Thu, 5 Jun 2008 08:05:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0a323aa1-95ce-4d88-bc18-7431bc7a4194@a1g2000hsb.googlegroups.com> References: <871w3j3ul8.fsf@kobe.laptop> <0a9bfa85-9062-47db-9c28-d7f6933a72f2@e53g2000hsa.googlegroups.com> <3ed818c4-ad1a-48d9-b2ab-68a6b15afa71@l64g2000hse.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1212680508 27960 80.91.229.12 (5 Jun 2008 15:41:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Jun 2008 15:41:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 05 17:42:28 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K4HbS-0001b8-Mq for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jun 2008 17:42:18 +0200 Original-Received: from localhost ([127.0.0.1]:56986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4HaR-0004ds-NK for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jun 2008 11:41:11 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!a1g2000hsb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Original-NNTP-Posting-Host: 168.7.13.133 Original-X-Trace: posting.google.com 1212678327 8552 127.0.0.1 (5 Jun 2008 15:05:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 5 Jun 2008 15:05:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a1g2000hsb.googlegroups.com; posting-host=168.7.13.133; posting-account=fxB97woAAABg6Wi3tmJV7LZi5ZS_5kQW User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9b5) Gecko/2008050509 Firefox/3.0b5,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:159123 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:54473 Archived-At: On Jun 5, 12:41=A0am, Kevin Rodgers wrote: > xz wrote: > > ~~~ > >> which means, if I only want turn on this longlines-mode when editing > >> latex/tex file, then I add the following to .emacs: > >> (add-hook 'tex-mode-hook 'longlines-mode) > > >> Is that correct? > >> But it seems not working...... > > > I mean it works when I add > > (add-hook 'text-mode-hook 'longlines-mode) > > > while it does work if I only add > > (add-hook 'tex-mode-hook 'longlines-mode) > > >>> Here's the second way: > >>> (add-hook 'find-file-hook 'longlines-mode) > >>> (add-hook 'find-file-not-found-functions 'longlines-mode) > > Many text-editing (major) modes besides Text mode call text-mode-hook, > including Plain Tex, LaTex, and SliTex modes (try `M-x > apropos-documentation RET text-mode-hook RET'). =A0And the various Tex > modes then call tex-mode-hook, and then their specific mode hook > (e.g. plain-tex-mode-hook). > > Since longlines-mode toggles Long Lines (minor) mode, having the > function on both text-mode-hook and tex-mode-hook turns it on and then > off in a Tex buffer. > thanks for your reply. > So if you only want it on in Tex modes, put longlines-mode on > tex-mode-hook only. This was what I did. If I only put (add-hook 'tex-mode-hook 'longlines-mode) and there is no sentence like (add-hook 'text-mode-hook 'longlines-mode), then nothing happened: the longlines-mode is not turned on. > Or if you want it on in all text editing modes > (including Tex modes), put longlines-mode on text-mode-hook only. > > If you'd rather avoid having to remember all that, it's better to use a > function on those hooks that unconditionally turns it on. =A0Many minor > modes have turn-on-foo-mode and turn-off-foo-mode convenience functions > for that purpose, but you can fake it with an anonymous function: > > =A0 =A0 =A0(add-hook 'text-mode-hook (lambda () (longlines-mode 1))) > =A0 =A0 =A0(add-hook 'tex-mode-hook (lambda () (longlines-mode 1))) > > or define your own convenience function and use that instead: > > =A0 =A0 =A0(defun turn-on-longlines-mode () > =A0 =A0 =A0 =A0"Turn on Long Lines mode." > =A0 =A0 =A0 =A0(longlines-mode 1)) > =A0 =A0 =A0(add-hook 'text-mode-hook 'turn-on-longlines-mode) > =A0 =A0 =A0(add-hook 'tex-mode-hook 'turn-on-longlines-mode) > > -- > Kevin Rodgers > Denver, Colorado, USA