all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#17761: 24.3.91; smie-for-sexp and parentheses of-by-one bug?
@ 2014-06-12 11:58 Leo Liu
  2014-06-13 15:33 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Liu @ 2014-06-12 11:58 UTC (permalink / raw
  To: 17761


1. Open a buffer in octave mode and insert ( ) with point between the
   parentheses

2. Eval (smie-forward-sexp) which should give back something like
   (t 2 ")")

POS is before the token ")" instead of the end position of the token. Is
this a bug? This can often cause infinite loop if one is not careful.

BTW, although smie-config-guess's return value is not documented, it
seems no harm to do something like the following:

=== modified file 'lisp/emacs-lisp/smie.el'
--- lisp/emacs-lisp/smie.el	2014-03-04 08:35:11 +0000
+++ lisp/emacs-lisp/smie.el	2014-06-12 11:20:38 +0000
@@ -2156,7 +2156,7 @@
       (user-error "This buffer does not seem to be using SMIE"))
   (let ((config (smie-config--guess (point-min) (point-max))))
     (cond
-     ((null config) (message "Nothing to change"))
+     ((null config) (message "Nothing to change") nil)
      ((null smie-config--buffer-local)
       (message "Local rules set")
       (setq smie-config--buffer-local config))

Thanks,
Leo





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#17761: 24.3.91; smie-for-sexp and parentheses of-by-one bug?
  2014-06-12 11:58 bug#17761: 24.3.91; smie-for-sexp and parentheses of-by-one bug? Leo Liu
@ 2014-06-13 15:33 ` Stefan Monnier
  2014-06-13 16:14   ` Leo Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2014-06-13 15:33 UTC (permalink / raw
  To: Leo Liu; +Cc: 17761

> 1. Open a buffer in octave mode and insert ( ) with point between the
>    parentheses
> 2. Eval (smie-forward-sexp) which should give back something like
>    (t 2 ")")
> POS is before the token ")" instead of the end position of the token. Is
> this a bug?

Indeed, thanks.  I installed a patch into `emacs-24' which should
fix this.  As you can see, SMIE is mostly used to parse backward!

> BTW, although smie-config-guess's return value is not documented, it
> seems no harm to do something like the following:

Using its return value is an error, so I'd rather not encourage this error.


        Stefan





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#17761: 24.3.91; smie-for-sexp and parentheses of-by-one bug?
  2014-06-13 15:33 ` Stefan Monnier
@ 2014-06-13 16:14   ` Leo Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Leo Liu @ 2014-06-13 16:14 UTC (permalink / raw
  To: Stefan Monnier; +Cc: 17761-done

Fixed 24.4

On 2014-06-13 11:33 -0400, Stefan Monnier wrote:
> Indeed, thanks.  I installed a patch into `emacs-24' which should
> fix this.  As you can see, SMIE is mostly used to parse backward!

Indeed and thanks for the fix.

Leo





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-13 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-12 11:58 bug#17761: 24.3.91; smie-for-sexp and parentheses of-by-one bug? Leo Liu
2014-06-13 15:33 ` Stefan Monnier
2014-06-13 16:14   ` Leo Liu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.