Subject: bug#36401: closed (Re: bug#36401: 26.0.90; set-auto-mode uses case-insensitive match for magic-mode-alist)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 20 Jul 2019 09:36:02 +0000

Your bug report

#36401: 26.0.90; set-auto-mode uses case-insensitive match for magic-mode-alist

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
36401: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36401
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#36401: 26.0.90; set-auto-mode uses case-insensitive match for magic-mode-alist
From: Eli Zaretskii <[email-masked]>
To: Benjamin Riefenstahl <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 20 Jul 2019 12:35:06 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Benjamin Riefenstahl <[email-masked]>
> Cc: Benjamin Riefenstahl <[email-masked]>,  [email-masked]
> Date: Sun, 14 Jul 2019 17:23:57 +0200
> 
> Eli Zaretskii writes:
> > I think this is an omission.  Please do propose a patch to fix it.
> 
> See attached.  This applies against master, but the conflict against
> emacs-26 is also just minor.  Please advise if you want this
> differently.

Thanks, pushed to the master branch.

Subject: 26.0.90; set-auto-mode uses case-insensitive match for magic-mode-alist
From: Benjamin Riefenstahl <[email-masked]>
To: [email-masked]
Date: Thu, 27 Jun 2019 11:30:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

My use case: I use "magic-mode-alist" to detect a binary file type for
which I have written a mode.  The magic at the beginning is "mTFf", so
it is simple ASCII, but unusually capitalized.  When I add this to
"magic-mode-alist", files and buffers that start with "mtff" are also
put in my binary file mode.

It turns out that "set-auto-mode" in lisp/files.el is the function that
uses magic-mode-alist, and it just calls "looking-at" to test the type.
Because "case-fold-search" is "t" by default, this catches files
starting with "mtff".

Is this intentional?  If so, the documentation for "magic-mode-alist"
should call this out, so users know they might need to work around it.
If not, I could propose a patch to fix it.

TIA, benny

-- 

In GNU Emacs 26.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2017-10-18 built on riefenstahl-linux
Repository revision: b970a4a52a1c04afce4916ca2bf337e2b36d26c4
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.11 (jessie)

Recent messages:
Mark set
Saving file /home/riefenstahl/.emacs.cfg/local.riefenstahl-linux.el...
Wrote /home/riefenstahl/.emacs.cfg/local.riefenstahl-linux.el
(No changes need to be saved)
Auto-saving...done
Saving file /home/riefenstahl/.emacs.cfg/local.riefenstahl-linux.el...
Wrote /home/riefenstahl/.emacs.cfg/local.riefenstahl-linux.el
(No changes need to be saved) [6 times]
Making completion list...
Type "q" in help window to restore its previous buffer.

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

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

Major mode: Emacs-Lisp

Minor modes in effect:
  global-magit-file-mode: t
  magit-file-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  desktop-save-mode: t
  display-time-mode: t
  diff-auto-refine-mode: t
  delete-selection-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-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:
~/site-lisp/css-mode hides /usr/local/share/emacs/26.0.90/lisp/textmodes/css-mode

Features:
(shadow sort mail-extr emacsbug sendmail find-dired thingatpt eieio-opt
speedbar sb-image ezimage dframe find-func ruler-mode hl-line hexl pp
cl-print misearch multi-isearch help-fns arc-mode archive-mode
benny-mtff-mode magit-obsolete magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-collab ghub-graphql
ghub url-http tls gnutls url-gw nsm url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap let-alist json magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
magit-core magit-autorevert autorevert filenotify magit-process
magit-margin magit-mode git-commit magit-git magit-section magit-utils
crm subr-x magit-popup log-edit message-x message rmc puny rfc822 mml
mml-sec epa epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log with-editor cl-extra
help-mode async-bytecomp async dash elec-pair dired-aux make-mode
time-date map sh-script smie executable desktop frameset highline
ange-ftp generic-x cl autoinsert ps-print ps-print-loaddefs ps-def lpr
dired dired-loaddefs benny-x-clipboard disp-table mm-util mail-prsvr
time server protbuf solar cal-dst cal-islam cal-hebrew holidays
hol-loaddefs vc-git diff-mode easy-mmode diary-lib diary-loaddefs
cal-menu calendar cal-loaddefs which-func imenu jka-compr grep compile
delsel cus-start cus-load generic benny-calendar-cfg derived cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs filecache benny-file-cache tramp-sh docker-tramp tramp-cache
tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
comint ansi-color ring parse-time format-spec advice benny-unicode
benny-tools browse-url autoload radix-tree lisp-mnt finder-inf gh-common
marshal eieio-compat rx info 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 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 lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 418674 115456)
 (symbols 48 37479 2)
 (miscs 40 2593 3720)
 (strings 32 93366 4129)
 (string-bytes 1 2851917)
 (vectors 16 66469)
 (vector-slots 8 1822112 223144)
 (floats 8 700 564)
 (intervals 56 6177 3982)
 (buffers 992 36)
 (heap 1024 70067 2662))