all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode)
@ 2016-04-18 15:52 Mohammed Sadik
       [not found] ` <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mohammed Sadik @ 2016-04-18 15:52 UTC (permalink / raw)
  To: 23308

In c-mode (may be in other modes too), lines like #include <stdio.h>
sometimes break (nth 0 (syntax-ppss)), the depth of brackets. This
happens because angle brackets ('<' and '>') in #include lines are
considered to be brackets (which is true) in emacs 25.0.92, but not
in emacs 24.5, where syntax-ppss doesn't break.

How to reproduce:

open a new c file: emacs -Q test.c

Type the following in the file (where | is the point):

     #include <>

     int
     main (void)
     {
       |
     }

Now move between the angle brackets (| is the point):
    #include <|>

    ...

Now type some header names:

    #include <stdio.h|>

    ...

Now check the first value of (syntax-ppss). It is zero.

Now move to some other point (don't press RET). Check the value of
syntax-ppss.
The value is negative when outside of any paren,



In GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-13 built on fedora.localdomain
Windowing system distributor 'Fedora Project', version 11.0.11800000
Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: en_IN.UTF-8
  value of $LC_NUMERIC: en_IN.UTF-8
  value of $LC_TIME: en_IN.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: C/l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent messages:
Making completion list... [2 times]
Quit
(0 nil 27 nil nil nil 0 nil nil nil)
(1 34 47 nil nil nil 0 nil nil (34)) [2 times]
(1 34 42 nil nil nil 0 nil nil (34))
(1 34 47 nil nil nil 0 nil nil (34)) [2 times]
(0 nil 18 nil nil nil 0 nil nil nil)
(1 10 11 nil nil nil 0 nil nil (10))
Quit
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec epg epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils kmacro
cl-extra help-mode cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs pcase cl-lib
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 107267 13276)
 (symbols 48 21692 0)
 (miscs 40 83 207)
 (strings 32 19882 3213)
 (string-bytes 1 682011)
 (vectors 16 14908)
 (vector-slots 8 453358 9139)
 (floats 8 170 204)
 (intervals 56 250 42)
 (buffers 976 13)
 (heap 1024 39952 1257))





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

* bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode)
       [not found] ` <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org>
@ 2016-04-20  8:27   ` Alan Mackenzie
  2016-04-20 12:47     ` Mohammed Sadik
       [not found]     ` <CANHUxH0Y8VdSemySSQ3Kx=cmSVKGz6=PPifCPQJzPd_fhrxtow@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Mackenzie @ 2016-04-20  8:27 UTC (permalink / raw)
  To: Mohammed Sadik; +Cc: 23308

Hello, Mohammed.

In article <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org> you wrote:
> In c-mode (may be in other modes too), lines like #include <stdio.h>
> sometimes break (nth 0 (syntax-ppss)), the depth of brackets. This
> happens because angle brackets ('<' and '>') in #include lines are
> considered to be brackets (which is true) in emacs 25.0.92, but not
> in emacs 24.5, where syntax-ppss doesn't break.

Yes, indeed.  Thanks for taking the trouble to report this bug, and
thanks even more for distilling the problem down to a small, easy to work
with test case.

> How to reproduce:

> open a new c file: emacs -Q test.c

> Type the following in the file (where | is the point):

>      #include <>

>      int
>      main (void)
>      {
>        |
>      }

> Now move between the angle brackets (| is the point):
>     #include <|>

>     ...

> Now type some header names:

>     #include <stdio.h|>

>     ...

> Now check the first value of (syntax-ppss). It is zero.

> Now move to some other point (don't press RET). Check the value of
> syntax-ppss.
> The value is negative when outside of any paren,

This was actually quite tricky to track down.  It was caused by an
erroneous fix to a bug in 2010, which has since been properly fixed by
other means.

> In GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
>  of 2016-04-13 built on fedora.localdomain
> Windowing system distributor 'Fedora Project', version 11.0.11800000
> Configured features:
> XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS
> LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Would you please try out the following patch, and let me know whether it
fixes the bug completely, and if not, what problems still remain.
(cc-engine.el is in directory .../emacs/lisp/progmodes.)  Thanks!


diff -r cf78a1fa7d43 cc-engine.el
--- a/cc-engine.el	Sat Apr 02 17:35:03 2016 +0000
+++ b/cc-engine.el	Wed Apr 20 08:14:02 2016 +0000
@@ -3443,7 +3443,7 @@
 		(< c-state-old-cpp-beg here))
 	   (c-with-all-but-one-cpps-commented-out
 	    c-state-old-cpp-beg
-	    (min c-state-old-cpp-end here)
+	    c-state-old-cpp-end
 	    (c-invalidate-state-cache-1 here))
 	 (c-with-cpps-commented-out
 	  (c-invalidate-state-cache-1 here))))


-- 
Alan Mackenzie (Nuremberg, Germany).






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

* bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode)
  2016-04-20  8:27   ` Alan Mackenzie
@ 2016-04-20 12:47     ` Mohammed Sadik
       [not found]     ` <CANHUxH0Y8VdSemySSQ3Kx=cmSVKGz6=PPifCPQJzPd_fhrxtow@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Mohammed Sadik @ 2016-04-20 12:47 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 23308

> Yes, indeed.  Thanks for taking the trouble to report this bug, and
> thanks even more for distilling the problem down to a small, easy to work
> with test case.
>

Thanks for your kind words. This is just my 3rd bug report. :-)

> Would you please try out the following patch, and let me know whether it
> fixes the bug completely, and if not, what problems still remain.
> (cc-engine.el is in directory .../emacs/lisp/progmodes.)  Thanks!
>
Sure. I shall try.

> diff -r cf78a1fa7d43 cc-engine.el
> --- a/cc-engine.el	Sat Apr 02 17:35:03 2016 +0000
> +++ b/cc-engine.el	Wed Apr 20 08:14:02 2016 +0000
> @@ -3443,7 +3443,7 @@
>  		(< c-state-old-cpp-beg here))
>  	   (c-with-all-but-one-cpps-commented-out
>  	    c-state-old-cpp-beg
> -	    (min c-state-old-cpp-end here)
> +	    c-state-old-cpp-end
>  	    (c-invalidate-state-cache-1 here))
>  	 (c-with-cpps-commented-out
>  	  (c-invalidate-state-cache-1 here))))
>
Yes. This does fix the problem. Thanks for the patch. Hope it wont
break anything else.

Could you please look into
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23313 bug, if
you have time?

Thank you.





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

* bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode)
       [not found]     ` <CANHUxH0Y8VdSemySSQ3Kx=cmSVKGz6=PPifCPQJzPd_fhrxtow@mail.gmail.com>
@ 2016-04-29 14:42       ` Alan Mackenzie
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2016-04-29 14:42 UTC (permalink / raw)
  To: 23308-done; +Cc: Mohammed Sadik

Bug fixed in emacs-25 branch.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

end of thread, other threads:[~2016-04-29 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18 15:52 bug#23308: 25.0.92; angle brackects in #include breaks syntax-ppss (c-mode) Mohammed Sadik
     [not found] ` <mailman.621.1460994789.7477.bug-gnu-emacs@gnu.org>
2016-04-20  8:27   ` Alan Mackenzie
2016-04-20 12:47     ` Mohammed Sadik
     [not found]     ` <CANHUxH0Y8VdSemySSQ3Kx=cmSVKGz6=PPifCPQJzPd_fhrxtow@mail.gmail.com>
2016-04-29 14:42       ` Alan Mackenzie

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.