From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: smie-next-sexp make last seen keyword available Date: Sun, 30 Sep 2012 07:57:58 -0400 Message-ID: <85bognyb7d.fsf@member.fsf.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1349006591 5077 80.91.229.3 (30 Sep 2012 12:03:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Sep 2012 12:03:11 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 30 14:03:17 2012 Return-path: Envelope-to: ged-emacs-devel@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 1TIIEo-0007tl-F1 for ged-emacs-devel@m.gmane.org; Sun, 30 Sep 2012 14:03:10 +0200 Original-Received: from localhost ([::1]:60554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIIEi-00054g-V3 for ged-emacs-devel@m.gmane.org; Sun, 30 Sep 2012 08:03:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIIEg-00054a-8J for emacs-devel@gnu.org; Sun, 30 Sep 2012 08:03:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIIEe-0008MG-Uk for emacs-devel@gnu.org; Sun, 30 Sep 2012 08:03:02 -0400 Original-Received: from qmta09.westchester.pa.mail.comcast.net ([76.96.62.96]:48083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIIEe-0008MC-Qs for emacs-devel@gnu.org; Sun, 30 Sep 2012 08:03:00 -0400 Original-Received: from omta10.westchester.pa.mail.comcast.net ([76.96.62.28]) by qmta09.westchester.pa.mail.comcast.net with comcast id 5PlK1k0090cZkys59Q347P; Sun, 30 Sep 2012 12:03:04 +0000 Original-Received: from TAKVER ([69.140.67.196]) by omta10.westchester.pa.mail.comcast.net with comcast id 5Pxz1k00R4E4Fsd3WPxzkX; Sun, 30 Sep 2012 11:57:59 +0000 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (windows-nt) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 76.96.62.96 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153751 Archived-At: I'm rewriting the Emacs Ada mode indentation engine. The trigger was the new Ada 2012 syntax; it was just too daunting a task to try to squeeze that into the Ada mode 4.01 indentation code, which is totally ad hoc. Someone pointed me to SMIE; thank you Stefan! It is a very useful tool. I was worried that Ada would prove too complex for operator precedence parsing, but so far it is going well. My current code is at http://stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html#ada-mode-5.0 It is still a work in progress. I'm currently using Emacs 24.2; I could move to trunk if necessary. I have a request for an additional feature for smie-next-sexp; make the last seen keyword available. Consider the following Ada code: type Private_Type_2 is abstract tagged limited record Component_1 : Integer; Component_2 : Integer; Component_3 : Integer; end record; In order to have "end record" align with "with record", I've arranged the precedence for "record" to be higher than "is". "abstract" "tagged" "limited" are all identifiers in the smie grammar; they are optional keywords in Ada. Starting from "end", smie-backward-sexp leaves point on "abstract", and returns "is" as the found token. But I need point on "record", which is the last smie keyword seen. I can easily navigate back to "record" using "smie-default-forward-token", but since "smie-backward-sexp" has already seen "record", it would be cleaner to have it cache the info, and either return it in its return value, or store it in a smie global variable. Any suggestions on whether this is a good idea, or the best way to implement it? -- -- Stephe