GNU bug report logs - #75884
29.4; Dash character "-" appears as diff when it is the leading character in a line in a patch

Previous Next

Package: emacs;

Reported by: Husain Alshehhi <husain <at> alshehhi.io>

Date: Mon, 27 Jan 2025 03:41:02 UTC

Severity: minor

Tags: confirmed

Found in version 29.4

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Husain Alshehhi <husain <at> alshehhi.io>, Dmitry Gutov <dmitry <at> gutov.dev>, Juri Linkov <juri <at> linkov.net>, Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 75884 <at> debbugs.gnu.org
Subject: bug#75884: 29.4; Dash character "-" appears as diff when it is the leading character in a line in a patch
Date: Sat, 08 Feb 2025 11:32:41 +0200
> Date: Sun, 26 Jan 2025 21:39:35 -0600
> From: Husain Alshehhi <husain <at> alshehhi.io>
> 
> diff-mode does not handle a patch very well. In particular, if a patch
> contains the commit message, and if the commit message contains a dash
> character "-" at the beginning of a line, diff-mode interprets this as a
> diff rather than part of the commit message.
> 
> To replicate this bug: copy the following in a file (e.g. test.patch),
> open it in diff-mode, and you will see that the line "- unordered lists"
> shows up in `diff-indicator-removed' face:

I also see the final "--" line in that face, FWIW.

Dmitry, Juri, Sean: any comments or suggestions?

> 
> --8<---------------cut here---------------start------------->8---
> From: me <at> example.com
> Date: Thu, 01 Jan 2025 00:00:00 -0000
> Subject: [PATCH] Adding a comment
> 
> This is a commit to test emacs mode for displaying dash "-" character
> such as:
> 
> - unordered lists        << This will be displayed as a diff.
> - with multiple items    << So will this.
> 
> Emacs shows unordered lists as part of the diff because they start with
> "-".
> ---
>   main.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/main.c b/main.c
> index 5df43ae..43b62fa 100644
> --- a/main.c
> +++ b/main.c
> @@ -1,4 +1,5 @@
>   int main() {
> +  // adding a comment.
>     printf("hello world");
>     return 0;
>   }
> -- 
> 
> 2.47.1
> --8<---------------cut here---------------end--------------->8---
> 
> See
> https://lists.gnu.org/archive/html/help-gnu-emacs/2025-01/msg00229.html
> for reference.
> 
> 
> In GNU Emacs 29.4 (build 2, x86_64-suse-linux-gnu, GTK+ Version 3.24.43,
> cairo version 1.18.2)
> System Description: openSUSE Tumbleweed
> 
> Configured using:
>   'configure --disable-build-details --without-pop --with-mailutils
>   --with-native-compilation --without-hesiod --with-gameuser=:games
>   --with-kerberos --with-kerberos5 --with-file-notification=inotify
>   --with-modules --enable-autodepend --prefix=/usr
>   --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
>   --localstatedir=/var --sharedstatedir=/var/lib
>   --libexecdir=/usr/libexec --with-file-notification=yes
>   --libdir=/usr/lib64
>   --enable-locallisppath=/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
>   --with-x --with-xim --with-sound --with-xpm --with-jpeg --with-tiff
>   --with-gif --with-png --with-rsvg --with-dbus --with-webp --with-xft
>   --with-imagemagick --without-gpm --with-x-toolkit=gtk3 --with-pgtk
>   --with-toolkit-scroll-bars --x-includes=/usr/include
>   --x-libraries=/usr/lib64 --with-libotf --with-m17n-flt --with-cairo
>   --with-xwidgets --build=x86_64-suse-linux --with-dumping=pdumper
>   'CFLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
>   -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
>   -fstack-clash-protection -Werror=return-type -flto=auto -g
>   -D_GNU_SOURCE -DGDK_DISABLE_DEPRECATION_WARNINGS
>   -DGLIB_DISABLE_DEPRECATION_WARNINGS -pipe -Wno-pointer-sign
>   -Wno-unused-variable -Wno-unused-label -fno-optimize-sibling-calls
>   -DPDMP_BASE='\''"emacs-wayland"'\''' LDFLAGS=-Wl,-O2'
> 
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ
> IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES
> NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3
> THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB
> 
> Important settings:
>    value of $LC_NUMERIC: POSIX
>    value of $LANG: en_US.UTF-8
>    value of $XMODIFIERS: @im=local
>    locale-coding-system: utf-8-unix
> 
> Major mode: Article
> 
> Minor modes in effect:
>    org-roam-db-autosync-mode: t
>    global-git-commit-mode: t
>    magit-auto-revert-mode: t
>    shell-dirtrack-mode: t
>    global-corfu-mode: t
>    corfu-mode: t
>    vertico-mode: t
>    which-key-mode: t
>    override-global-mode: t
>    tooltip-mode: t
>    global-eldoc-mode: t
>    show-paren-mode: t
>    electric-indent-mode: t
>    mouse-wheel-mode: t
>    file-name-shadow-mode: t
>    global-font-lock-mode: t
>    font-lock-mode: t
>    buffer-read-only: t
>    column-number-mode: t
>    line-number-mode: t
>    transient-mark-mode: t
>    auto-composition-mode: t
>    auto-encryption-mode: t
>    auto-compression-mode: t
> 
> Load-path shadows:
> /home/husain/.emacs.d/elpa/compat-29.1.4.2/compat hides 
> /usr/share/emacs/site-lisp/compat
> /home/husain/.emacs.d/elpa/compat-29.1.4.2/compat-29 hides 
> /usr/share/emacs/site-lisp/compat-29
> /home/husain/.emacs.d/elpa/compat-29.1.4.2/compat-28 hides 
> /usr/share/emacs/site-lisp/compat-28
> /home/husain/.emacs.d/elpa/compat-29.1.4.2/compat-27 hides 
> /usr/share/emacs/site-lisp/compat-27
> /home/husain/.emacs.d/elpa/compat-29.1.4.2/compat-26 hides 
> /usr/share/emacs/site-lisp/compat-26
> /home/husain/.emacs.d/elpa/compat-29.1.4.2/compat-25 hides 
> /usr/share/emacs/site-lisp/compat-25
> /home/husain/.emacs.d/elpa/transient-20230919.2146/transient hides 
> /usr/share/emacs/29.4/lisp/transient
> /home/husain/.emacs.d/elpa/jsonrpc-1.0.24/jsonrpc hides 
> /usr/share/emacs/29.4/lisp/jsonrpc
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package hides 
> /usr/share/emacs/29.4/lisp/use-package/use-package
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-lint 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-lint
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-jump 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-jump
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-ensure
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-diminish
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-delight 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-delight
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-core 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-core
> /home/husain/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key 
> hides /usr/share/emacs/29.4/lisp/use-package/use-package-bind-key
> /home/husain/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides 
> /usr/share/emacs/29.4/lisp/use-package/bind-key
> /home/husain/.emacs.d/elpa/eglot-1.17/eglot hides 
> /usr/share/emacs/29.4/lisp/progmodes/eglot
> /home/husain/.emacs.d/elpa/eldoc-1.15.0/eldoc hides 
> /usr/share/emacs/29.4/lisp/emacs-lisp/eldoc
> 
> Features:
> (mailalias mailclient dabbrev mm-archive misearch multi-isearch shadow
> bbdb-message emacsbug mule-util smiley gnus-cite message-view-patch
> mail-extr textsec uni-scripts idna-mapping ucs-normalize uni-confusable
> textsec-check gnus-bcklg gnus-async sort gnus-ml disp-table
> cello-light-theme ef-cherie-theme ef-themes consult nndraft nnmh
> nnmaildir bbdb-gnus nnnil gnus-agent gnus-srvr gnus-score score-mode
> nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls
> dig nntp gnus-cache gnus-sum gnus-group gnus-undo gnus-start gnus-dbus
> dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time gnus-spec
> gnus-int gnus-range gnus-win org-roam-protocol org-protocol
> org-roam-migrate org-roam-log org-roam-mode org-roam-capture org-roam-id
> org-roam-node org-roam-db emacsql-sqlite-builtin sqlite org-roam-utils
> org-roam-compat org-roam org-capture org-attach emacsql-sqlite
> emacsql-sqlite-common emacsql emacsql-compiler elfeed-show elfeed-search
> vc-git vc-dispatcher elfeed-csv elfeed elfeed-curl elfeed-log elfeed-db
> elfeed-lib url-queue xml-query erc-goodies erc iso8601 erc-backend
> erc-networks erc-common erc-compat erc-loaddefs bbdb-mua bbdb-com bbdb
> bbdb-site timezone gnus nnheader range org-noter org-noter-djvu
> org-noter-nov nov recentf tree-widget shr pixel-fill kinsoku url-file
> svg xml esxml-query dom org-noter-pdf org-noter-core pdf-tools cus-edit
> cus-load wid-edit pdf-view magit-bookmark bookmark pp jka-compr
> pdf-cache pdf-info tq pdf-util pdf-macs image-mode exif ledger-mode
> ledger-check ledger-texi ledger-test ledger-sort ledger-report
> ledger-reconcile ledger-occur ledger-fonts ledger-fontify ledger-state
> ledger-complete ledger-schedule ledger-init ledger-xact ledger-post
> ledger-exec ledger-navigate eshell esh-cmd esh-ext esh-opt esh-proc
> esh-io esh-arg esh-module esh-groups esh-util files-x ledger-context
> ledger-commodities ledger-regex scad-mode ox-gfm htmlize ob-latex ox-odt
> rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse
> nxml-ns nxml-enc xmltok nxml-util ox-md ox-latex ox-icalendar ox-html
> table ox-ascii ox-publish ox org-habit org-agenda org-element
> org-persist xdg org-id org-refile org ob ob-tangle ob-ref ob-lob
> ob-table org-macro org-src ob-comint org-pcomplete org-list org-footnote
> org-faces org-entities noutline outline ob-emacs-lisp org-table org-keys
> org-loaddefs find-func avl-tree ol oc ob-exp ob-core org-cycle org-fold
> org-fold-core org-compat ob-eval org-version org-macs link-hint
> goto-addr avy cal-menu calendar cal-loaddefs ediff ediff-merg ediff-mult
> ediff-wind ediff-diff ediff-help ediff-init ediff-util git-link
> magit-submodule 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 which-func imenu magit-diff
> smerge-mode diff diff-mode git-commit log-edit message sendmail
> yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg
> rfc6068 epg-config gnus-util 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-margin magit-transient
> magit-process with-editor time-date shell pcomplete server magit-mode
> transient magit-git magit-base magit-section format-spec cursor-sensor
> crm dash edmacro kmacro sqlformat reformatter go-mode find-file ffap
> thingatpt etags fileloop generator xref project scala-mode
> scala-mode-prettify-symbols scala-mode-imenu scala-mode-map
> scala-mode-fontlock scala-mode-indent scala-mode-paragraph
> scala-mode-syntax scala-mode-lib typescript-mode cc-mode cc-fonts
> cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
> compile text-property-search comint ansi-osc ring yaml-mode ansi-color
> exec-path-from-shell corfu orderless vertico compat diminish which-key
> use-package use-package-ensure use-package-delight use-package-diminish
> use-package-bind-key bind-key use-package-core finder-inf comp comp-cstr
> warnings icons rx cl-extra help-mode ispell bbdb-autoloads
> corfu-autoloads diminish-autoloads ef-themes-autoloads eglot-autoloads
> eldoc-autoloads elfeed-autoloads emacs-everywhere-autoloads
> embark-consult-autoloads consult-autoloads embark-autoloads
> exec-path-from-shell-autoloads f-autoloads ggtags-autoloads
> git-link-autoloads go-mode-autoloads htmlize-autoloads jsonrpc-autoloads
> ledger-mode-autoloads link-hint-autoloads marginalia-autoloads
> markdown-mode-autoloads magit-autoloads git-commit-autoloads
> modus-themes-autoloads nov-autoloads orderless-autoloads
> org-noter-autoloads org-roam-autoloads magit-section-autoloads
> emacsql-autoloads ox-gfm-autoloads pdf-tools-autoloads request-autoloads
> scad-mode-autoloads scala-mode-autoloads show-font-autoloads
> sqlformat-autoloads reformatter-autoloads standard-themes-autoloads
> tablist-autoloads transient-autoloads treemacs-autoloads
> posframe-autoloads ht-autoloads hydra-autoloads pfuture-autoloads
> ace-window-autoloads avy-autoloads s-autoloads dash-autoloads
> typescript-mode-autoloads use-package-autoloads bind-key-autoloads
> vertico-autoloads w3m-load w3m-autoloads which-key-autoloads
> with-editor-autoloads info compat-autoloads yaml-mode-autoloads
> auctex-autoloads tex-site package browse-url url url-proxy url-privacy
> url-expand url-methods url-history url-cookie generate-lisp-file
> url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
> eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
> bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc delsel lpr
> easy-mmode pcase iso-transl tooltip cconv eldoc paren electric uniquify
> ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
> pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt
> fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
> register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
> scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
> frame minibuffer nadvice seq simple cl-generic indonesian philippine
> 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 emoji-zwj charscript
> charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
> cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
> files window text-properties overlay sha1 md5 base64 format env
> code-pages mule custom widget keymap hashtable-print-readable backquote
> threads xwidget-internal dbusbind inotify dynamic-setting
> system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty
> make-network-process native-compile emacs)
> 
> Memory information:
> ((conses 16 1306461 97685)
>   (symbols 48 47318 18)
>   (strings 32 522080 13600)
>   (string-bytes 1 26474941)
>   (vectors 16 262284)
>   (vector-slots 8 3657817 148039)
>   (floats 8 1262 501)
>   (intervals 56 4819 450)
>   (buffers 984 34))
> 
> 
> 
> 




This bug report was last modified 130 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.