GNU bug report logs - #70365
29.2; Unable to remove suffixes such as Emacs-Lisp/l or C++//l from mode-name variable

Previous Next

Package: emacs;

Reported by: Animesh Sahu <animeshz916 <at> gmail.com>

Date: Sat, 13 Apr 2024 08:15:05 UTC

Severity: normal

Tags: notabug

Found in version 29.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70365 in the body.
You can then email your comments to 70365 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70365; Package emacs. (Sat, 13 Apr 2024 08:15:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Animesh Sahu <animeshz916 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 13 Apr 2024 08:15:07 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Animesh Sahu <animeshz916 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.2; Unable to remove suffixes such as Emacs-Lisp/l or C++//l from
 mode-name variable
Date: Sat, 13 Apr 2024 12:56:20 +0530
[Message part 1 (text/plain, inline)]
--text follows this line--

I was trying to set up emacs modeline, the major modes however under the
variable name "mode-name" seems to have a suffix injected, and thus it
renders either C++//l instead of C++ and Emacs-Lisp/l instead of
Emacs-Lisp, I would like it to be simply the name of major mode without
extra details. And I don't seem to find any way of doing that anywhere on
the internet.

Closest I could find something is here:
https://www.reddit.com/r/emacs/comments/8v8de4/change_modename_for_major_mode/
it suggests doing something like (defalias 'c-update-modeline #'ignore),
but this doesn't seem right way to do it, since its basically doing only
for C or C++ language, same has to be done for java, ts, many more. Also
Emacs-Lisp/l doesn't have similar function that can be suppressed with
'ignore either, so I don't see a concrete way of doing it.

Any help would be appreciated, thanks!


In GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.0, Xaw3d scroll bars)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Void Linux

Configured using:
 'configure
 --prefix=/nix/store/5hl68vr85cagmwaycqy652r2g2isjcyq-emacs-29.2
 --disable-build-details --with-modules --with-x-toolkit=lucid
 --with-xft --with-cairo --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --without-small-ja-dic --with-tree-sitter
 --with-xinput2 --without-xwidgets'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

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

Major mode: Org

Minor modes in effect:
  org-html-themify-mode: t
  hl-todo-mode: t
  telephone-line-mode: t
  global-hl-line-mode: t
  marginalia-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  vertico-mode: t
  which-key-mode: t
  undo-fu-session-global-mode: t
  undo-fu-session-mode: t
  global-evil-collection-unimpaired-mode: t
  evil-collection-unimpaired-mode: t
  evil-mode: t
  evil-local-mode: t
  general-override-mode: t
  shell-dirtrack-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  winner-mode: t
  recentf-mode: t
  savehist-mode: t
  elpaca-use-package-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
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: #[128 \304\300\301 #\207 [yas--auto-fill #[128
\301\302\300! "\207 [auto-fill-function apply default-value] 4

(fn &rest ARGS)] :around nil apply] 5 advice]
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/nix/store/1vlha7xa4myxc37y3463c2f481w3vw81-emacs-packages-deps/share/emacs/site-lisp/site-start
hides
/nix/store/5hl68vr85cagmwaycqy652r2g2isjcyq-emacs-29.2/share/emacs/site-lisp/site-start
/home/animesh/.emacs.d/elpaca/builds/transient/transient hides
/nix/store/5hl68vr85cagmwaycqy652r2g2isjcyq-emacs-29.2/share/emacs/29.2/lisp/transient

Features:
(shadow sort mail-extr emacsbug cua-base cl-print em-unix em-term
evil-collection-term term disp-table ehelp em-script em-ls em-hist
em-pred em-glob em-extpipe em-cmpl em-dirs esh-var em-basic em-banner
em-alias evil-collection-eshell em-prompt esh-mode eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
company-elisp org-html-themify 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-latex ox-icalendar org-agenda ox-html table ox-ascii
ox-publish ox htmlize oc-basic ol-eww evil-collection-eww eww url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom browse-url gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
gnus-spec gnus-int gnus-range message sendmail yank-media puny rfc822
mml mml-sec evil-collection-epa epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win evil-collection-gnus
gnus nnheader gnus-util mail-utils range mm-util mail-prsvr ol-docview
evil-collection-doc-view doc-view filenotify evil-collection-image
image-mode exif evil-collection-dired dired dired-loaddefs ol-bibtex
bibtex ol-bbdb ol-w3m ol-doi org-link-doi pp mule-util
evil-collection-vc-git vc-git evil-collection-diff-mode diff-mode
vc-dispatcher jka-compr hl-todo company-yasnippet hexrgb telephone-line
telephone-line-segments telephone-line-separators telephone-line-utils
doom-city-lights-theme doom-themes-ext-visual-bell face-remap hl-line
doom-themes doom-themes-base evil-collection-helpful helpful cc-langs
evil-collection-imenu imenu trace evil-collection-edebug edebug
evil-collection-debug debug backtrace info-look evil-collection-info
info f help-fns radix-tree evil-collection-elisp-refs elisp-refs
marginalia evil-collection-embark embark-org org-element org-persist xdg
org-id org-refile avl-tree embark projectile lisp-mnt
evil-collection-grep grep evil-collection-compile compile
text-property-search ibuf-ext evil-collection-ibuffer ibuffer
ibuffer-loaddefs nix-mode ffap smie nix-repl nix-shell nix-store
evil-collection-magit-section magit-section cursor-sensor nix-log
nix-instantiate nix-shebang nix-format nix evil-collection-markdown-mode
markdown-mode color yasnippet company-tabnine s dash company-oddmuse
company-keywords company-etags etags fileloop generator
evil-collection-xref xref company-gtags company-dabbrev-code
company-dabbrev company-files company-clang company-capf company-cmake
company-semantic company-template company-bbdb evil-collection-company
company hop orderless evil-collection-vertico vertico compat
evil-collection-which-key which-key evil-collection-vundo vundo
undo-fu-session undo-fu hl-todo-autoloads org-html-themify-autoloads
htmlize-autoloads hexrgb-autoloads telephone-line-autoloads
doom-themes-autoloads helpful-autoloads f-autoloads elisp-refs-autoloads
marginalia-autoloads embark-autoloads projectile-autoloads
nix-mode-autoloads magit-section-autoloads transient-autoloads
markdown-mode-autoloads yasnippet-autoloads company-tabnine-autoloads
dash-autoloads s-autoloads company-autoloads hop-autoloads
orderless-autoloads vertico-autoloads compat-autoloads
which-key-autoloads vundo-autoloads undo-fu-session-autoloads
undo-fu-autoloads chdir chdir-core tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat parse-time iso8601 pcre pcre-core
evil-collection-unimpaired evil-collection-tabulated-list
evil-collection-tab-bar evil-collection-simple evil-collection-replace
evil-collection-python evil-collection-process-menu
evil-collection-outline evil-collection-org evil-collection-indent
evil-collection-help evil-collection-elisp-mode evil-collection-eldoc
evil-collection-elpaca evil-collection-comint evil-collection-calendar
evil-collection-buff-menu evil-collection annalist evil evil-integration
evil-maps evil-commands reveal evil-jumps evil-command-window evil-types
evil-search evil-ex evil-macros evil-repeat evil-states evil-core advice
evil-common thingatpt rect evil-vars edmacro kmacro comp comp-cstr
warnings general evil-collection-autoloads annalist-autoloads
evil-autoloads goto-chg-autoloads general-autoloads cl-extra help-mode
ob-js ob-C cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs ob-ruby ob-python python project pcase treesit
ob-shell shell display-line-numbers winner recentf tree-widget wid-edit
savehist org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src ob-comint org-pcomplete pcomplete comint ansi-osc ansi-color
ring org-list org-footnote org-faces org-entities time-date noutline
outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx
org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu
calendar cal-loaddefs org-version org-compat org-macs format-spec
elpaca-use-package use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core elpaca-use-package-autoloads elpaca-log elpaca-ui url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util url-parse auth-source eieio
eieio-core password-cache json subr-x map byte-opt bytecomp byte-compile
url-vars mailcap cl-seq cl-macs elpaca elpaca-process cl-loaddefs cl-lib
elpaca-autoloads early-init gv rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 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 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 dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 967497 256396)
 (symbols 48 49654 3)
 (strings 32 312726 26972)
 (string-bytes 1 9196016)
 (vectors 16 93110)
 (vector-slots 8 2293913 442255)
 (floats 8 906 1912)
 (intervals 56 4205 1976)
 (buffers 984 26))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70365; Package emacs. (Sat, 13 Apr 2024 09:43:03 GMT) Full text and rfc822 format available.

Message #8 received at 70365 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Animesh Sahu <animeshz916 <at> gmail.com>
Cc: 70365 <at> debbugs.gnu.org
Subject: Re: bug#70365: 29.2;
 Unable to remove suffixes such as Emacs-Lisp/l or C++//l from
 mode-name variable
Date: Sat, 13 Apr 2024 12:42:10 +0300
tags 70365 notabug
thanks

> From: Animesh Sahu <animeshz916 <at> gmail.com>
> Date: Sat, 13 Apr 2024 12:56:20 +0530
> 
> I was trying to set up emacs modeline, the major modes however under the variable name "mode-name"
> seems to have a suffix injected, and thus it renders either C++//l instead of C++ and Emacs-Lisp/l instead of
> Emacs-Lisp, I would like it to be simply the name of major mode without extra details. And I don't seem to find
> any way of doing that anywhere on the internet.

Can't you simply overwrite the value of mode-name in your mode hook?

Or modify the value of mode-line-modes to use some other variable
instead of mode-name, and then set the value of that other variable as
you see fit.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 13 Apr 2024 09:43:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70365; Package emacs. (Sat, 13 Apr 2024 12:02:02 GMT) Full text and rfc822 format available.

Message #13 received at 70365 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Animesh Sahu <animeshz916 <at> gmail.com>
Cc: 70365 <at> debbugs.gnu.org
Subject: Re: bug#70365: 29.2; Unable to remove suffixes such as Emacs-Lisp/l
 or C++//l from mode-name variable
Date: Sat, 13 Apr 2024 15:00:39 +0300
[Please use Reply All to reply, to keep the bug tracker CC'ed.]

> From: Animesh Sahu <animeshz916 <at> gmail.com>
> Date: Sat, 13 Apr 2024 16:18:20 +0530
> 
> I would not like this to be a per-mode fix for every language, I already linked closest I could get to this issue, in
> my previous mail:
> 
> > Closest I could find something is here:
> https://www.reddit.com/r/emacs/comments/8v8de4/change_modename_for_major_mode/ it suggests doing
> something like (defalias 'c-update-modeline #'ignore), but this doesn't seem right way to do it, since its
> basically doing only for C or C++ language, same has to be done for java, ts, many more. Also Emacs-Lisp/l
> doesn't have similar function that can be suppressed with 'ignore either, so I don't see a concrete way of
> doing it.

You should be able to do this globally in a
after-change-major-mode-hook, I think.  Although I don't think I
understand how you can do that regardless of the mode, since you
cannot know in advance what will a mode possibly append to mode-name
-- it could be something you want to leave alone in some modes.  So a
mode-specific setting sounds like the best idea to me, if you ask me.

There's also the other possibility I mentioned: to modify
mode-line-modes so as to use some other variable for showing the mode
name.  You can then control the value of that variable.  This is not a
mode specific solution.

> I would like to have these variables populated by their own modes. Although I don't find a generic way to
> disable that in all the languages / major modes. 

I'm not sure what is it that you expect us to do here.  We are not
going to change how these mode names are displayed by default, so
whatever you want to do it will have to be in your own local
customizations.  I've pointed out several possible ways of performing
such customizations.  If this is not enough, or you need more
assistance in accomplishing this, I suggest to post a question on
help-gnu-emacs <at> gnu.org, where people could help you implement this.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 13 Apr 2024 14:32:05 GMT) Full text and rfc822 format available.

Notification sent to Animesh Sahu <animeshz916 <at> gmail.com>:
bug acknowledged by developer. (Sat, 13 Apr 2024 14:32:06 GMT) Full text and rfc822 format available.

Message #18 received at 70365-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Animesh Sahu <animeshz916 <at> gmail.com>
Cc: 70365-done <at> debbugs.gnu.org
Subject: Re: bug#70365: 29.2; Unable to remove suffixes such as Emacs-Lisp/l
 or C++//l from mode-name variable
Date: Sat, 13 Apr 2024 17:30:55 +0300
> From: Animesh Sahu <animeshz916 <at> gmail.com>
> Date: Sat, 13 Apr 2024 18:27:00 +0530
> 
> Got it, thanks for the help :)

Thanks, so I'm closing this bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 May 2024 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 days ago.

Previous Next


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