unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28218: 26.0.50; TOML table name fontification on lines with comments
@ 2017-08-24 13:34 Kaushal Modi
  2017-08-25 15:57 ` Tom Tromey
  2017-08-27  2:48 ` bug#28218: done Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Kaushal Modi @ 2017-08-24 13:34 UTC (permalink / raw)
  To: 28218, tom


[-- Attachment #1.1: Type: text/plain, Size: 9764 bytes --]

Hi Tom,

Thanks for adding the conf-toml-mode.

As soon as I saw it, I tested it out with my Hugo blog config.toml.

Everything looks good except for fontification on lines that have comments
with square brackets (see the attached screenshot)

[image: image.png]

Here's another screenshot, this one from my real config.toml (note the
fontification of Taxonomies table name):

[image: image.png]


In GNU Emacs 26.0.50 (build 38, x86_64-pc-linux-gnu, GTK+ Version 2.24.23)
 of 2017-08-24
Repository revision: fa5e63e40412f6152dbe079a766845112d598479
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6
(Santiago)

Recent messages:
File digital/tb/models/model_validation/model_bndgapref_core/svtb/
model_bndgapref_core_base_test.sv added to project /proj/ad9555/sos_kmodi/
cache.
File digital/tb/models/model_validation/model_bndgapref_core/README added
to project /proj/ad9555/sos_kmodi/ cache.
Wrote /home/kmodi/.emacs.d/emacs_26_0.desktop.lock
Desktop: 1 frame, 94 buffers restored, 1 failed to restore.
Updating buffer list...
Formats have changed, recompiling...done
Updating buffer list...done
ibuffer-projectile: groups set
Marked 7 buffers
Operation finished; killed 7 buffers

Configured using:
 'configure --with-modules
 --prefix=/home/kmodi/usr_local/apps/6/emacs/master
 '--program-transform-name=s/^ctags$/ctags_emacs/'
 'CPPFLAGS=-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2
 -I/usr/include' 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Conf[TOML]

Minor modes in effect:
  global-auto-complete-mode: t
  minibuffer-line-mode: t
  which-key-mode: t
  ivy-mode: t
  projectile-mode: t
  global-hardcore-mode: t
  hardcore-mode: t
  desktop-save-mode: t
  save-place-mode: t
  minibuffer-depth-indicate-mode: t
  winner-mode: t
  smart-mark-mode: t
  delete-selection-mode: t
  which-function-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-page-break-lines-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  Info-breadcrumbs-in-mode-line-mode: t
  global-hungry-delete-mode: t
  hungry-delete-mode: t
  volatile-highlights-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  diff-auto-refine-mode: t
  global-git-commit-mode: t
  recentf-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  shell-dirtrack-mode: t
  async-bytecomp-package-mode: t
  engine-mode: t
  beacon-mode: t
  shackle-mode: t
  mode-line-space-mode: t
  display-time-mode: t
  modi-mode: t
  override-global-mode: t
  show-paren-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/kmodi/.emacs.d/elisp/verilog-mode/verilog-mode hides
/home/kmodi/usr_local/apps/6/emacs/master/share/emacs/26.0.50/lisp/progmodes/verilog-mode

Features:
(shadow sort mail-extr emacsbug sendmail colir color smex ido counsel
jka-compr esh-util swiper cursor-sensor setup-desktop
auto-complete-config python tramp-sh tramp tramp-compat tramp-loaddefs
trampver ucs-normalize parse-time csh-mode sh-script smie tcl isend-mode
term ehelp cperl-mode header2 iso-transl network-stream starttls
url-http tls gnutls url-gw nsm url-cache url-auth verilog-mode org-eldoc
org-indent org-info fill-column-indicator yasnippet flycheck flymake
flymake-proc flymake-ui auto-complete popup minibuffer-line flyspell
ispell which-key ivy-hydra ivy ivy-overlay ffap ibuffer-projectile
projectile grep ibuf-ext ibuffer ibuffer-loaddefs hardcore-mode vc-git
conf-mode desktop frameset setup-pragmata-ligatures setup-font-check
smyx-theme diff-hl vc-dir vc vc-dispatcher elec-pair setup-misc
saveplace executable setup-personal my-patches setup-meme setup-work
setup-windows-buffers mb-depth winner setup-unicode setup-toggles
setup-spell setup-search setup-registers setup-print setup-pdf
setup-navigation setup-mouse setup-launcher setup-image setup-editing
smart-mark unfill zop-to-char delsel setup-compile setup-backup
setup-yaml-mode setup-web-mode setup-verilog setup-hugo setup-tcl
setup-sml setup-spice setup-shell setup-python setup-perl setup-nim
setup-matlab setup-markdown setup-latex preview-latex tex-site
auto-loads setup-elisp easy-escape setup-conf setup-clojure
setup-yasnippet setup-xkcd setup-writegood writegood-mode
setup-wrap-region wrap-region setup-wordnut setup-wolfram
setup-which-key setup-which-func which-func imenu setup-weather
setup-undo-tree undo-tree diff setup-tldr setup-tiny setup-term setup-sx
setup-smex setup-server setup-rainbow-mode setup-rainbow-delimiters
rainbow-delimiters setup-projectile setup-poporg setup-pomodoro
setup-pcache pcache eieio-base cl setup-page-break-lines disp-table
page-break-lines setup-outshine foldout outshine outshine-org-cmds
outorg org-sticky-header org-include-img-from-archive
org-include-img-from-pdf org-include-src-lines ob-org ob-latex ob-dot
ob-ditaa ob-plantuml ob-awk ob-python ob-shell org-link-ref elfeed-link
org-element elfeed-show elfeed-search bookmark pp shr svg dom elfeed-csv
elfeed elfeed-curl url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf mailcap elfeed-log elfeed-db
elfeed-lib url-util avl-tree generator url-queue browse-url xml-query
xml org org-macro org-footnote org-pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs noutline
outline setup-orgstruct setup-org setup-news setup-neotree
setup-multiple-cursors setup-manage-minor-mode setup-linum nlinum linum
setup-kurecolor setup-keyfreq keyfreq setup-info info+ thingatpt
setup-indent-guide setup-imenu-list setup-ivy setup-ibuffer
setup-hungry-delete hungry-delete setup-htmlize setup-highlight hl-line+
hl-line volatile-highlights hi-lock setup-header2 setup-hardcore
setup-magit magit-log magit-diff smerge-mode diff-mode git-commit
recentf tree-widget log-edit message subr-x puny dired-collapse f dired+
image-dired image-mode image-file help-fns+ wid-edit help-fns radix-tree
dired-aux dired-x dired dired-loaddefs rfc822 mml mml-sec epa derived
epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-process with-editor shell
pcomplete server magit-margin magit-mode magit-git magit-section
magit-utils crm magit-popup async-bytecomp async format-spec
setup-git-timemachine setup-git-link setup-diff setup-gist
setup-flycheck setup-fold yafolding fold-this setup-fci
setup-expand-region setup-engine-mode engine-mode setup-el2markdown
setup-eww setup-emamux setup-elfeed setup-drag-stuff setup-dired
setup-deft setup-de-ansify setup-counsel setup-command-log-mode
setup-calc setup-buffer-move setup-bookmarks setup-beacon beacon
setup-auto-complete setup-artist setup-all setup-ag setup-ace-window
setup-abbrev setup-shackle shackle setup-visual generic setup-mode-line
smart-mode-line-dark-theme smart-mode-line rich-minority time setup-tags
ctags-update ggtags etags xref project compile comint ansi-color ewoc
pcase setup-hydra hydra ring lv setup-key-chord
setup-region-bindings-mode region-bindings-mode cl-extra help-mode
setup-paradox temp-mode modi-mode use-package-chords bind-chord
key-chord use-package diminish bind-key easy-mmode benchmark-init advice
setup-packages gh-common gh-profile rx s marshal eieio-compat ht json
map dash finder-inf info edmacro kmacro package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib general time-date paren cus-start
cus-load setup-var-overrides mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors 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 composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray 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 996149 98454)
 (symbols 48 58605 1)
 (miscs 40 5254 545)
 (strings 32 413439 20933)
 (string-bytes 1 19711285)
 (vectors 16 86467)
 (vector-slots 8 1421450 95235)
 (floats 8 871 1338)
 (intervals 56 9315 3156)
 (buffers 992 102)
 (heap 1024 119086 102819))

-- 

Kaushal Modi

[-- Attachment #1.2: Type: text/html, Size: 12530 bytes --]

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 5364 bytes --]

[-- Attachment #3: image.png --]
[-- Type: image/png, Size: 45896 bytes --]

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

* bug#28218: 26.0.50; TOML table name fontification on lines with comments
  2017-08-24 13:34 bug#28218: 26.0.50; TOML table name fontification on lines with comments Kaushal Modi
@ 2017-08-25 15:57 ` Tom Tromey
  2017-08-25 16:21   ` Kaushal Modi
  2017-08-27  2:48 ` bug#28218: done Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2017-08-25 15:57 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 28218

Oops, meant to CC the bug.

>> As soon as I saw it, I tested it out with my Hugo blog config.toml.

Nice, thanks.

>> Everything looks good except for fontification on lines that have
>> comments with square brackets (see the attached screenshot)

The appended patch worked ok on these examples for me.

Maybe it isn't ideal because I think you can do weird things like:

    [section."quoted[]name"]

... and this regexp won't pick that up.

I'm inclined to install this anyway, since it's an improvement, even
though it isn't perfect.

Hmm, maybe it can be fixed using a function to search for the matching
bracket.  I will give that a try.

Tom

diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 7bcc695..38d617e 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -254,9 +254,9 @@ conf-colon-font-lock-keywords
 
 (defvar conf-toml-font-lock-keywords
   '(;; [section] (do this first because it may look like a parameter)
-    ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
+    ("^\\s-*\\[\\([^]]+\\)\\]" 1 'font-lock-type-face)
     ;; var=val or var[index]=val
-    ("^[ \t]*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?[ \t]*="
+    ("^\\s-*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?\\s-*="
      (1 'font-lock-variable-name-face)
      (2 'font-lock-constant-face nil t))
     ("\\_<false\\|true\\_>" 0 'font-lock-keyword-face))





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

* bug#28218: 26.0.50; TOML table name fontification on lines with comments
  2017-08-25 15:57 ` Tom Tromey
@ 2017-08-25 16:21   ` Kaushal Modi
  2017-08-27  2:39     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Kaushal Modi @ 2017-08-25 16:21 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 28218

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

On Fri, Aug 25, 2017 at 11:57 AM Tom Tromey <tom@tromey.com> wrote:

> Oops, meant to CC the bug.
>
> >> As soon as I saw it, I tested it out with my Hugo blog config.toml.
>
> Nice, thanks.
>
> >> Everything looks good except for fontification on lines that have
> >> comments with square brackets (see the attached screenshot)
>
> The appended patch worked ok on these examples for me.
>

Thank you. I confirm the fix on my config files.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 875 bytes --]

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

* bug#28218: 26.0.50; TOML table name fontification on lines with comments
  2017-08-25 16:21   ` Kaushal Modi
@ 2017-08-27  2:39     ` Tom Tromey
  2017-08-27 12:19       ` Kaushal Modi
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2017-08-27  2:39 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Tom Tromey, 28218

Kaushal> Thank you. I confirm the fix on my config files. 

I rewrote the change to deal with more cases:

* [[section]],
* quoted strings in sections, and
* an attempt to differentiate between sections and arrays

I'm installing this new change.

Tom





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

* bug#28218: done
  2017-08-24 13:34 bug#28218: 26.0.50; TOML table name fontification on lines with comments Kaushal Modi
  2017-08-25 15:57 ` Tom Tromey
@ 2017-08-27  2:48 ` Tom Tromey
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2017-08-27  2:48 UTC (permalink / raw)
  To: 28218-done

I've checked in the fix.

Tom





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

* bug#28218: 26.0.50; TOML table name fontification on lines with comments
  2017-08-27  2:39     ` Tom Tromey
@ 2017-08-27 12:19       ` Kaushal Modi
  0 siblings, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2017-08-27 12:19 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 28218

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

On Sat, Aug 26, 2017, 10:39 PM Tom Tromey <tom@tromey.com> wrote:

> Kaushal> Thank you. I confirm the fix on my config files.
>
> I rewrote the change to deal with more cases:
>
> * [[section]],
> * quoted strings in sections, and
> * an attempt to differentiate between sections and arrays
>
> I'm installing this new change.
>

Awesome! Thanks.

> --

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 895 bytes --]

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

end of thread, other threads:[~2017-08-27 12:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24 13:34 bug#28218: 26.0.50; TOML table name fontification on lines with comments Kaushal Modi
2017-08-25 15:57 ` Tom Tromey
2017-08-25 16:21   ` Kaushal Modi
2017-08-27  2:39     ` Tom Tromey
2017-08-27 12:19       ` Kaushal Modi
2017-08-27  2:48 ` bug#28218: done Tom Tromey

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).