Subject: bug#37681: 27.0.50; rainbow-mode highlights some URL fragments when it should not

From: Nate Eagleson <[email-masked]>
Date: Wed, 09 Oct 2019 11:20:50 -0400

If a URL contains a fragment identifier that can be interpreted as a
hexademical color, rainbow-mode will highlight it as such.

For instance, in the URL 'http://localhost/test#debug', the string
'#deb' is highlighted as a color.

Recipe:

Run `emacs -Q` at a bash prompt.

Do `M-x load-file` and load rainbow-mode.el 1.0.1 (in my setup it's at
~/.emacs.d/elpa/rainbow-mode-1.0.1/rainbow-mode.el).

In the *scratch* buffer, do `M-x rainbow-mode`.

Insert "http://localhost/test/#debug".

Note that the substring "#deb" is highlighted.

In GNU Emacs 27.0.50 (build 4, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G87))
 of 2019-08-21 built on NXT-NEAGLESON
Repository revision: 50dc4ca8d02a466a7236765edf83ae7cfb02d74c
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.6

Recent messages:
Saving file /Users/neagleson/daily-log/2019-10-09.txt...
Wrote /Users/neagleson/daily-log/2019-10-09.txt
Total time worked this week: 23 hours, 54 minutes
Mark set
Saving file /Users/neagleson/daily-log/2019-10-09.txt...
Wrote /Users/neagleson/daily-log/2019-10-09.txt
Saving file /Users/neagleson/daily-log/2019-10-09.txt...
Wrote /Users/neagleson/daily-log/2019-10-09.txt
Reverting buffer ‘config.xml’. [7 times]
ESC ESC M-b is undefined

Configured using:
 'configure --with-ns --with-imagemagick --with-modules
 --enable-silent-rules PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
 LDFLAGS=-L/usr/local/lib LDFLAGS=-L/usr/lib
 CPPFLAGS=-I/usr/local/include
 CPPFLAGS=-I/usr/local/Cellar/libxml2/2.9.7/include/libxml2 CC=clang
 OBJC=clang 'CFLAGS=-g -O2''

Configured features:
IMAGEMAGICK NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
MODULES THREADS PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Markdown

Minor modes in effect:
  global-magit-file-mode: t
  magit-file-mode: t
  magit-auto-revert-mode: t
  recentf-mode: t
  flycheck-mode: t
  auto-complete-mode: t
  aggressive-fill-paragraph-mode: t
  savehist-mode: t
  focus-autosave-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  which-function-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  git-gutter-mode: t
  evil-commentary-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  smartparens-mode: t
  auto-insert-mode: t
  global-auto-revert-mode: t
  helm-mode: t
  projectile-mode: t
  beacon-mode: t
  evil-leader-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  flyspell-mode: t
  shell-dirtrack-mode: t
  evil-local-mode: t
  override-global-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: yas--auto-fill
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/site-lisp/aggressive-fill-paragraph hides /Users/neagleson/.emacs.d/elpa/aggressive-fill-paragraph-20180910.816/aggressive-fill-paragraph
~/.emacs.d/site-lisp/crontab-mode hides /Users/neagleson/.emacs.d/elpa/crontab-mode-20190827.1300/crontab-mode
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-reconcile hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-reconcile
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-schedule hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-schedule
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-report hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-report
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-init hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-init
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-commodities hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-commodities
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-context hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-context
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-xact hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-xact
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-regex hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-regex
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-fontify hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-fontify
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-post hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-post
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-occur hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-occur
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-navigate hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-navigate
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-mode hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-mode
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-texi hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-texi
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-test hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-test
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-complete hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-complete
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-exec hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-exec
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-sort hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-sort
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-fonts hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-fonts
/usr/local/Cellar/ledger/3.1.1_3/share/emacs/site-lisp/ledger/ledger-state hides /Users/neagleson/.emacs.d/elpa/ledger-mode-20190925.1300/ledger-state
~/.emacs.d/site-lisp/magit-svn hides /Users/neagleson/.emacs.d/elpa/magit-svn-20190821.1455/magit-svn
/Users/neagleson/.emacs.d/elpa/lispy-20191002.1952/elpa hides /Users/neagleson/.emacs.d/elpa/ivy-20190919.1331/elpa
~/.emacs.d/site-lisp/transient hides /Users/neagleson/.emacs.d/elpa/transient-20191002.1142/transient
~/.emacs.d/site-lisp/css-mode hides /Applications/Emacs.app/Contents/Resources/lisp/textmodes/css-mode
/Users/neagleson/.emacs.d/elpa/less-css-mode-20161001.453/less-css-mode hides /Applications/Emacs.app/Contents/Resources/lisp/textmodes/less-css-mode
/Users/neagleson/.emacs.d/elpa/faceup-20170925.1946/faceup hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/faceup

Features:
(shadow emacsbug helm-ag browse-kill-ring magit-imenu git-rebase
magit-extras goto-line-preview pulse shr-color shr svg rng-xsd
xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode
nxml-outln nxml-rap nxml-util nxml-enc xmltok eieio-opt cl-print
help-fns radix-tree set-minor-mode-key ne-smart-dash-hacks sh-script
tern-auto-complete js2-refactor js2r-paredit js2r-conveniences
js2r-conditionals js2r-wrapping js2r-functions js2r-vars
multiple-cursors-core js2r-iife js2r-formatting js2r-helpers
cursor-sensor helm-swoop daily-log bug-reference magit-svn evil-magit
magit-bookmark magit-submodule magit-obsolete magit-popup magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert
magit-margin magit-transient magit-process magit-mode transient ac-emmet
emmet-mode rainbow-mode skewer-reload-stylesheets skewer-mode
cache-table js2-mode simple-httpd css-mode smie sgml-mode dom scss-mode
filecache recentf ido helm-x-files helm-for-files helm-bookmark
helm-adaptive bookmark speed-type mm-archive url-cache executable
helm-projectile misearch multi-isearch helm-command helm-elisp helm-eval
edebug backtrace helm-info epa-file gnutls mailalias smtpmail sendmail
sort mail-extr ac-ispell flymake-cc lsp-ui lsp-ui-flycheck lsp-ui-doc
lsp-ui-imenu lsp-ui-peek lsp-ui-sideline view lsp-clients lsp-haxe
lsp-erlang lsp-fsharp lsp-metals lsp-elm lsp-dart lsp-clojure lsp-go
lsp-xml lsp-css lsp-intelephense lsp-vetur lsp-html lsp-solargraph
lsp-rust lsp-pyls lsp php-auto-yasnippets hideshow php-mode-init
lsp-mode ewoc markdown-mode tree-widget spinner pcase network-stream
inline ht f em-glob esh-util dash-functional php-mode mode-local
speedbar sb-image ezimage dframe cc-langs php-face php php-project
winner image-file helm-external helm-net xml ffap elisp-slime-nav
cap-words superword subword glasses guess-style auto-complete-config
flycheck-objc-clang flycheck auto-complete popup
aggressive-fill-paragraph org-element avl-tree 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
unicode-troll-stopper frame-cmds frame-fns avoid my-frame-setup time
init savehist focus-autosave-mode conf-mode atomic-chrome websocket
bindat let-alist sensitive-mode my-functions camel-spell nginx-mode
mocha-snippets yasnippet csharp-mode slime etags fileloop generator xref
project arc-mode archive-mode noutline outline pp hyperspec
auto-rename-tag web-mode-edit-element web-mode-edit-element-elements
web-mode-edit-element-utils web-mode-edit-element-attributes web-mode
python-mode info-look tramp-sh tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat parse-time iso8601 ls-lisp
which-func hippie-exp flymake-proc flymake warnings jedi-force json-mode
json-reformat json-snatcher js imenu cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs tern url-http
url-auth url-gw nsm url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util smart-dash git-commit
with-editor async-bytecomp server magit-git magit-section magit-utils
log-edit pcvs-util add-log git-gutter ne-evil-textobjects
evil-commentary evil-commentary-integration evil-exchange evil-surround
evil-smartparens smartparens exato space-trail autoinsert
ne-yas-auto-insert autorevert filenotify helm-mode helm-files
helm-buffers helm-occur helm-tags helm-locate helm-grep helm-regexp
helm-utils helm-help helm-types helm helm-source eieio-compat
helm-multi-match helm-lib async projectile grep compile ibuf-ext ibuffer
ibuffer-loaddefs notmuch hl-line notmuch-hello wid-edit notmuch-tree
notmuch-show notmuch-print notmuch-crypto notmuch-mua notmuch-message
notmuch-draft notmuch-maildir-fcc notmuch-address notmuch-company
notmuch-parser notmuch-wash diff-mode coolj notmuch-query goto-addr
icalendar diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
notmuch-tag crm notmuch-lib notmuch-compat message rmc puny dired
dired-loaddefs format-spec rfc822 mml mailabbrev gmm-utils mailheader
mm-view mml-smime mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs mail-utils text-property-search time-date smime dig
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
mm-util ietf-drums mail-prsvr moody solarized-dark-theme solarized-theme
solarized color dash diminish beacon my-keybindings evil-leader evil
evil-keybindings evil-integration undo-tree diff evil-maps evil-commands
reveal flyspell ispell evil-jumps evil-command-window evil-types
evil-search evil-ex shell pcomplete evil-macros evil-repeat evil-states
evil-core evil-common windmove thingatpt rect evil-digraphs evil-vars s
use-package use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core
exec-path-from-shell edmacro kmacro paren shell-pop term disp-table
comint ansi-color ehelp ring delsel cus-start jka-compr cus-load
auto-compile packed ne-package-init finder-inf advice rx cl-extra
help-mode cl slime-autoloads info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win 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 threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 1963016 154140)
 (symbols 48 65950 32)
 (strings 32 358416 28278)
 (string-bytes 1 11901302)
 (vectors 16 135616)
 (vector-slots 8 2323962 204190)
 (floats 8 633 2518)
 (intervals 56 182675 3818)
 (buffers 992 103))