unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8169: 23.2; wrong fontification in gdb-script
@ 2011-03-03 21:03 Tom Tromey
  2011-03-04  4:49 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2011-03-03 21:03 UTC (permalink / raw)
  To: 8169


Visit a file named .gdbinit and enter:

define something
  echo hi
  # a comment
end

Notice that "end" is incorrect given the comment face.

This happens due to some logic in gdb-script-syntax-propertize-function.
It overrides the comment-end syntax on the newline.  But, this is
only really ok if the newline is actually part of a "document" command.

I looked at this a little but didn't see a simple way to fix it.




In GNU Emacs 23.2.1 (i386-redhat-linux-gnu, GTK+ Version 2.20.1)
 of 2010-06-03 on x86-07.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.10802000
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=at
 om -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Summary

Minor modes in effect:
  compilation-in-progress: (gid)
  gnus-agent-mode: t
  diff-auto-refine-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  shell-dirtrack-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
a k e s SPC t h e SPC p r o m p t SPC s h o w SPC u 
p SPC i m m e d i a t e l y . SPC SPC b u t SPC I S-SPC 
d SPC n o <M-backspace> <backspace> o SPC n o t SPC 
r e a l l y SPC u n d e r s t a n d SPC i t . SPC SPC 
a n d SPC M-b M-b M-b M-b M-b M-b M-b M-b M-b M-f SPC 
f o r SPC " r u n " C-e I SPC C-a C-k C-c C-n C-r p 
a l C-r v M-> C-r p e c o s M-> C-y C-l s t i l l <M-backspace> 
<M-backspace> t h e SPC C - c SPC b e h a v i o r SPC 
i s SPC a l s o SPC s t i l l SPC u p C-t z z l i n 
g <return> <f10> <f10> <f10> <f10> <switch-frame> <switch-frame> 
- l m e <backspace> c h e c k SPC d o e s SPC s o m 
e SPC C-a C-k n o t SPC r e a l l y , SPC b u t SPC 
C-y <M-backspace> <M-backspace> c a n SPC d o SPC s 
o m e SPC o f SPC i t C-a C-k <f10> <f10> M-v C-l C-z 
o M-v C-u C-u C-p C-n C-n p M-g M-g M-g M-g C-u C-p 
= <return> M-> C-p C-p SPC = C-l C-z n <f10> <f10> 
<f10> M-v M-v M-> C-x b <return> C-x b <return> C-z 
o M-v C-l M-x r e p o r t - e m <tab> b <tab> <ret
urn>

Recent messages:
Mark set
Mark saved where search started
Mark set [3 times]
Opening nntp server on news.gmane.org...done
Retrieving newsgroup: nntp+news.gmane.org:gmane.comp.gdb.patches...
Fetching headers for nntp+news.gmane.org:gmane.comp.gdb.patches...done
Generating summary...done
Mark set
call-interactively: Beginning of buffer
Mark set

Load-path shadows:
/home/tromey/lib/lisp/rpm-spec-mode hides /usr/share/emacs/site-lisp/rpm-spec-mode
/usr/share/emacs/site-lisp/flim/sha1 hides /usr/share/emacs/23.2/lisp/sha1
/usr/share/emacs/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4
/usr/share/emacs/site-lisp/flim/hex-util hides /usr/share/emacs/23.2/lisp/hex-util
/home/tromey/.emacs.d/elpa/css-mode-1.0/css-mode hides /usr/share/emacs/23.2/lisp/textmodes/css-mode
/home/tromey/.emacs.d/elpa/ruby-mode-1.0/ruby-mode hides /usr/share/emacs/23.2/lisp/progmodes/ruby-mode
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-glyph hides /usr/share/emacs/23.2/lisp/nxml/nxml-glyph
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-valid hides /usr/share/emacs/23.2/lisp/nxml/rng-valid
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-maint hides /usr/share/emacs/23.2/lisp/nxml/nxml-maint
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-cmpct hides /usr/share/emacs/23.2/lisp/nxml/rng-cmpct
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-loc hides /usr/share/emacs/23.2/lisp/nxml/rng-loc
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-dt hides /usr/share/emacs/23.2/lisp/nxml/rng-dt
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-parse hides /usr/share/emacs/23.2/lisp/nxml/rng-parse
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-uri hides /usr/share/emacs/23.2/lisp/nxml/rng-uri
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-util hides /usr/share/emacs/23.2/lisp/nxml/rng-util
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-uchnm hides /usr/share/emacs/23.2/lisp/nxml/nxml-uchnm
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-ns hides /usr/share/emacs/23.2/lisp/nxml/nxml-ns
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-rap hides /usr/share/emacs/23.2/lisp/nxml/nxml-rap
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/xsd-regexp hides /usr/share/emacs/23.2/lisp/nxml/xsd-regexp
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-mode hides /usr/share/emacs/23.2/lisp/nxml/nxml-mode
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-enc hides /usr/share/emacs/23.2/lisp/nxml/nxml-enc
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-outln hides /usr/share/emacs/23.2/lisp/nxml/nxml-outln
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-xsd hides /usr/share/emacs/23.2/lisp/nxml/rng-xsd
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-nxml hides /usr/share/emacs/23.2/lisp/nxml/rng-nxml
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-maint hides /usr/share/emacs/23.2/lisp/nxml/rng-maint
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/xmltok hides /usr/share/emacs/23.2/lisp/nxml/xmltok
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-util hides /usr/share/emacs/23.2/lisp/nxml/nxml-util
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/nxml-parse hides /usr/share/emacs/23.2/lisp/nxml/nxml-parse
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-pttrn hides /usr/share/emacs/23.2/lisp/nxml/rng-pttrn
/home/tromey/.emacs.d/elpa/nxml-mode-20041004/rng-match hides /usr/share/emacs/23.2/lisp/nxml/rng-match
/usr/share/emacs/site-lisp/flim/sasl-cram hides /usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs/site-lisp/flim/hmac-def hides /usr/share/emacs/23.2/lisp/net/hmac-def
/usr/share/emacs/site-lisp/flim/hmac-md5 hides /usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs/site-lisp/flim/sasl hides /usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs/site-lisp/flim/sasl-digest hides /usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs/site-lisp/flim/ntlm hides /usr/share/emacs/23.2/lisp/net/ntlm
/home/tromey/.emacs.d/elpa/emms-3.0/tq hides /usr/share/emacs/23.2/lisp/emacs-lisp/tq

Features:
(shadow emacsbug net-utils vcard nroff-mode log-edit url-cache url-http
tls url-gw url-auth pydoc-info-autoloads autoload tar-mode find-func
asm-mode erc-dcc tabify man assoc log-view pcvs-util thai-util thai-word
dired-aux m4-mode conf-mode gnus-topic sh-script executable compare-w
gnus-dup apropos nnfolder starttls mailalias smtpmail rfc2368 iswitchb
utf-7 info-look dictionary link connection cal-move autoconf
autoconf-mode texinfo find-dired cus-start cus-load autorevert imenu
ffap tcl smerge-mode vc-sccs vc-dir ewoc vc-rcs gnus-draft vc-annotate
gdb-ui bindat json gud find-file make-mode grep warnings vc-svn
python-21 python mule-util w3m-cookie w3m-bookmark w3m-tabmenu
w3m-session gnus-fun idutils jimb-patch vc vc-dispatcher copyright
edmacro kmacro vc-cvs goto-addr add-log diff-mode vc-git etags vc-bzr
cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs help-mode view bbdb-hooks dabbrev newcomment bbdb-sc supercite
regi mail-hist flow-fill erc-menu erc-join erc-ring erc-pcomplete
pcomplete erc-track erc-match erc-button erc-fill erc-stamp erc-netsplit
erc-spelling erc-truncate w3m-form w3m browse-url doc-view jka-compr
image-mode w3m-hist w3m-fb w3m-ems w3m-ccl ccl w3m-favicon w3m-image
w3m-proc w3m-util bbdb-gui gnus-cite smiley gnus-async gnus-bcklg
gnus-ml disp-table parse-time auth-source byte-opt bytecomp byte-compile
nnml nndraft nnmh bbdb-gnus bbdb-snarf mail-extr bbdb-com nnnil
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 epg-config mm-view smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int
gnus-range message idna sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 qp ietf-drums mailabbrev gmm-utils mailheader canlock sha1
sha1-el hex-util hashcash gnus-win gnus gnus-ems nnheader gnus-util
netrc mail-utils wid-edit multi-isearch gdb-shell compile ansi-color
shell flyspell ispell eldoc emms-status emms-lastfm emms-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-util url-parse url-vars mm-util mail-prsvr mailcap emms-browser sort
emms-playlist-sort emms-score emms-player-xine emms-player-mpd tq
emms-playing-time emms-lyrics time-date emms-streams emms-mode-line
emms-cache emms-info-ogginfo emms-info-mp3info emms-info later-do
emms-playlist-mode emms-player-mplayer emms-player-simple
emms-source-playlist emms-source-file dired emms-setup emms emms-compat
gdb-shell-autoloads nxml-enc info weblogger-autoloads xml-rpc-autoloads
package reporter cal-china lunar solar cal-dst cal-bahai cal-islam
cal-hebrew holidays hol-loaddefs appt diary-lib diary-loaddefs cal-menu
easymenu calendar cal-loaddefs uniquify mouse-sel easy-mmode status cl
cl-19 erc-services erc-networks erc-goodies erc erc-backend erc-compat
format-spec thingatpt pp bbdb timezone ange-ftp regexp-opt comint ring
server advice help-fns advice-preload u-vm-color vm-autoloads vm-vars
vm-version bbdb-autoloads tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)

Tom





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

* bug#8169: 23.2; wrong fontification in gdb-script
  2011-03-03 21:03 bug#8169: 23.2; wrong fontification in gdb-script Tom Tromey
@ 2011-03-04  4:49 ` Stefan Monnier
  2011-03-04 15:37   ` Tom Tromey
  2011-03-06 20:58   ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-03-04  4:49 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 8169

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

> Visit a file named .gdbinit and enter:

> define something
>   echo hi
>   # a comment
> end

> Notice that "end" is incorrect given the comment face.

> This happens due to some logic in gdb-script-syntax-propertize-function.
> It overrides the comment-end syntax on the newline.  But, this is
> only really ok if the newline is actually part of a "document" command.

Good point.  The patch below fixes this case, I think.


        Stefan "can't commit right now"


=== modified file 'lisp/progmodes/gud.el'
--- lisp/progmodes/gud.el	2011-01-25 20:26:05 +0000
+++ lisp/progmodes/gud.el	2011-03-04 04:47:29 +0000
@@ -3128,7 +3128,9 @@
    ("^document\\s-.*\\(\n\\)" (1 "< b"))
    ("^end\\(\\>\\)"
     (1 (ignore
-        (unless (eq (match-beginning 0) (point-min))
+        (when (and (> (match-beginning 0) (point-min))
+                   (eq 1 (nth 7 (save-excursion
+                                  (syntax-ppss (1- (match-beginning 0)))))))
           ;; We change the \n in front, which is more difficult, but results
           ;; in better highlighting.  If the doc is empty, the single \n is
           ;; both the beginning and the end of the docstring, which can't be






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

* bug#8169: 23.2; wrong fontification in gdb-script
  2011-03-04  4:49 ` Stefan Monnier
@ 2011-03-04 15:37   ` Tom Tromey
  2011-03-06 20:49     ` Stefan Monnier
  2011-03-06 20:58   ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2011-03-04 15:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 8169

Stefan> Good point.  The patch below fixes this case, I think.

Thanks.  I tried this and it works for the case I sent.  However, I
think it now fails on:

document something
this is some text
end

Now it gives "end" the string face.  In fact, it doesn't seem to
recognize the "end" at all any more, subsequent lines are also fontified
as strings.

Tom





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

* bug#8169: 23.2; wrong fontification in gdb-script
  2011-03-04 15:37   ` Tom Tromey
@ 2011-03-06 20:49     ` Stefan Monnier
  2011-03-07 14:44       ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2011-03-06 20:49 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 8169

> document something
> this is some text
> end

> Now it gives "end" the string face.  In fact, it doesn't seem to
> recognize the "end" at all any more, subsequent lines are also fontified
> as strings.

Are you testing it in Emacs-23 maybe, where (nth 7 (syntax-ppss)) never
return 1?


        Stefan





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

* bug#8169: 23.2; wrong fontification in gdb-script
  2011-03-04  4:49 ` Stefan Monnier
  2011-03-04 15:37   ` Tom Tromey
@ 2011-03-06 20:58   ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-03-06 20:58 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 8169-done

Version: 24.1

> Good point.  The patch below fixes this case, I think.

Installed,


        Stefan





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

* bug#8169: 23.2; wrong fontification in gdb-script
  2011-03-06 20:49     ` Stefan Monnier
@ 2011-03-07 14:44       ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2011-03-07 14:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 8169

Stefan> Are you testing it in Emacs-23 maybe, where (nth 7 (syntax-ppss)) never
Stefan> return 1?

It was some kind of operator error, since I updated and tried your
latest, and it works.

Tom





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

end of thread, other threads:[~2011-03-07 14:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-03 21:03 bug#8169: 23.2; wrong fontification in gdb-script Tom Tromey
2011-03-04  4:49 ` Stefan Monnier
2011-03-04 15:37   ` Tom Tromey
2011-03-06 20:49     ` Stefan Monnier
2011-03-07 14:44       ` Tom Tromey
2011-03-06 20:58   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).