From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: command-separator char Date: Tue, 23 Jun 2015 13:00:31 -0400 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1435079134 21550 80.91.229.3 (23 Jun 2015 17:05:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2015 17:05:34 +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 Jun 23 19:05: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 1Z7RdY-0000M2-Ly for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2015 19:05:28 +0200 Original-Received: from localhost ([::1]:46520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7RdX-0008WO-Pa for geh-help-gnu-emacs@m.gmane.org; Tue, 23 Jun 2015 13:05:27 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 63 Injection-Info: mx02.eternal-september.org; posting-host="3210e01ae7fd0841b6a9a36dd02a1f64"; logging-data="27479"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HPpNvaexi1Dk96wlekgUl" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:mv+PWUeLGYkR3FzzCJeqDAqtHqg= sha1:NodZEAvAsMDM5v1zs+SGSIm1ROA= Original-Xref: usenet.stanford.edu gnu.emacs.help:212816 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:105101 Archived-At: > Seems still no idea or definition what a sexp should be. Nope. It's only a UI issue. Sexp navigation is basically navigation within the AST, but a given buffer position corresponds to several different spots in the AST, so there's an ambiguity. Take your example line: echo "foo"; echo "asdf"; the AST looks like echo / cmd / \ / "foo" ; \ echo \ / cmd \ "asdf" The position at BOL can be take to be right before the "echo" node, or right before the first "cmd" node or right before the toplevel composite instruction that comprises the whole line. You can mostly tell SMIE which one you want if you call smie-forward-sexp, by passing it a token explaining the level you care about. But forward-sexp is called by the user without any extra info, so it has to make an arbitrary choice. For compatibility with the usual forward-sexp semantics, the choice it makes is to consider the "deepest" position in the tree. But as explained earlier, if you put point *before* a semi-colon, and then use M-C-f, then SMIE's forward-sexp will take this as a clue that you want to skip over whatever belongs to the right-hand of this semi-colon. So with point right after "foo", C-M-f will jump to right after "asdf". Along the same lines, you say: With cursor inside first string --> end of first string meaning that this is inconsistent, but it's perfectly consistent, since forward-sexp does not jump to "the end of the currently enclosing entity" but instead to "the end of the entity that starts right after point". SMIE's forward-sexp could very well check syntax-ppss to see we're inside a string (or comment) and move outside of that string, but then it would be a different command. Stefan PS: That doesn't mean that it always works right either, of course. M-C-f with point right after the second "o" of "foo" (i.e. right before the closing double quotes) should signal an error but will instead jump to right after the opening double quotes of "asdf". PPS: And `up-list' doesn't use SMIE quite right either.