From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: My humble additions to AUCTeX Date: Tue, 20 Jan 2015 16:25:59 +0100 Message-ID: <87r3upjx1v.fsf@wmi.amu.edu.pl> References: <20140113002818.77105028@aga-netbook> <87y52j6d3g.fsf@yahoo.fr> <20140113191650.0fce85c1@aga-netbook> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1421767591 19746 80.91.229.3 (20 Jan 2015 15:26:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Jan 2015 15:26:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 20 16:26:29 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 1YDahI-0001LX-Kp for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Jan 2015 16:26:28 +0100 Original-Received: from localhost ([::1]:43989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDahH-0007IU-Sk for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Jan 2015 10:26:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDah1-0007IA-Ld for help-gnu-emacs@gnu.org; Tue, 20 Jan 2015 10:26:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDagw-000765-U7 for help-gnu-emacs@gnu.org; Tue, 20 Jan 2015 10:26:11 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:53266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDagw-00075Y-KT for help-gnu-emacs@gnu.org; Tue, 20 Jan 2015 10:26:06 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id D9628481E2 for ; Tue, 20 Jan 2015 16:26:04 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JuAh39cp7+1e for ; Tue, 20 Jan 2015 16:26:04 +0100 (CET) Original-Received: from localhost (unknown [150.254.62.139]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id BB07F481E1 for ; Tue, 20 Jan 2015 16:26:04 +0100 (CET) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 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:102170 Archived-At: On 2014-01-13, at 21:47, Stefan Monnier wrote: >> Also, I want to level up the word commands to token-aware commands. > > That'd be a mistake. In Emacs, a "word" is not a "token". > > For those people who prefer symbol-navigation over word-navigation, > Emacs-24.4 offers superword-mode. And indeed, it would be nice to make > superword-mode understand TeX's notion of "symbol". OK, so let me revive this (over a year!) old thread. (Last time I wrote in it, I said that I'd look into new Emacs' superword-mode. Well, I just did.) Here's the catch (and the summary of what I want to accomplish). I'd like M-f and M-b treat \these \things \as \words in AUCTeX mode. The rationale is that they are really the basic components of a (La)TeX code. Now the advice Stefan gave me was to utilize superword-mode. I can see a few problems with this approach. First is subjective: I looked into the code, and have no idea how find-word-boundary-function-table works. >From what I /did/ understand is that in superword-mode, M-f (somehow?) calls (forward-symbol 1) and M-b calls (forward-symbol -1). Now, I could somehow substitute my function for forward-symbol (assuming that I will understand how that table works). However, as I alluded in one of my previous posts, in LaTeX files the code and (human-language) text are heavily interspersed. Take this line, for instance: I \emph{really} like \LaTeX. Assume that the point is at the beginning of line (I will denote it by the vertical line, |.) After a few subsequent presses of M-f, this is what I would like to achieve: I| \emph{really} like \LaTeX. I \emph|{really} like \LaTeX. I \emph{really|} like \LaTeX. I \emph{really} like| \LaTeX. I \emph{really} like \LaTeX|. This is in fact how Emacs operates by default. However, imagine that I start with the point at the end of line, and press M-b repeatedly. Here's what I'd like to see: I \emph{really} like \LaTeX. I \emph{really} like |\LaTeX. I \emph{really} |like \LaTeX. I \emph{|really} like \LaTeX. I |\emph{really} like \LaTeX. As you can see, it's different from the normal Emacs operation. OTOH, this@is@treated@as@one@symbol in AUCTeX; but email@address shouldn't. So when the point is after `foo@bar', and the user presses M-b, we should land at the `b'; but when the point if after `\foo@bar', and the user presses M-b, we should land at the backslash. (In fact, it's even more complicated than that, with the \makeatletter and stuff, but let's forget about it now.) Yet another example: I'd like M-b to move to the backslash when the point is after the comma in `foo\,'. Normally, both (backward-word) and (forward-symbol -1) travel all the way to the `f'. In fact, I would also like a (single) M-f or M-b to skip the /entire/ math formula ($...$ or \(...\)) when I'm on its delimiter (this is probably even more unorthodox, but would be very handy: M-f and M-b would allow me to move between parts of the formula when I'm inside, but would treat it as a single entity when I'm outside!) Now I could more or less easily code these functions and e.g. define a suitable minor mode. My question is not how to do this, but /where/ to put my functions, so to speak. IOW, what is the best/suggested practice here? Should I just turn it on in AUCTeX mode? (Probably not the best idea ever.) Should I utilize superword mode? (Might not be a good idea either, since it might not work the way I want it to /outside/ TeX commands.) Should I define my own minor mode where I redefine M-f and M-b? (And M-d etc.? This seems the best solution to me.) > Stefan Best, -- Marcin Borkowski This email was proudly sent http://mbork.pl from my Emacs.