GNU bug report logs - #59719
29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons

Previous Next

Package: emacs;

Reported by: Kai Ma <justksqsf <at> gmail.com>

Date: Wed, 30 Nov 2022 14:07:02 UTC

Severity: minor

Found in version 29.0.60

Done: Juri Linkov <juri <at> linkov.net>

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 59719 in the body.
You can then email your comments to 59719 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#59719; Package emacs. (Wed, 30 Nov 2022 14:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kai Ma <justksqsf <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 30 Nov 2022 14:07:02 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; emacs-news-mode does not adjust the width of the fringe to
 accommodate the outline icons
Date: Wed, 30 Nov 2022 17:10:40 +0800
[Message part 1 (text/plain, inline)]
The fringe is too small to accomodate the icons, but emacs-news-mode
does not adjust the width.  This is especially bad for the 'emoji'
icons.

Symbol icons:

[emacs-symbol.png (image/png, attachment)]
[Message part 3 (text/plain, inline)]
Text icons:

[emacs-text.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]
Emoji icons:

[emacs-emoji.png (image/png, attachment)]
[Message part 7 (text/plain, inline)]
Also reproducible on emacs -Q:

[emacs-Q.png (image/png, attachment)]
[Message part 9 (text/plain, inline)]

In GNU Emacs 29.0.60 (build 4, x86_64-apple-darwin22.1.0, NS
 appkit-2299.00 Version 13.0.1 (Build 22A400)) of 2022-11-29 built on
 Kais-MacBook.local
Repository revision: 067c65578e02034d7605f1dcaf6a6d0c4bbdbda3
Repository branch: emacs-29
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.0.1

Configured using:
 'configure --with-xwidgets --with-json --with-native-compilation'

Configured features:
ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_ALL: zh_CN.utf-8
  value of $LANG: zh_CN.utf-8
  locale-coding-system: utf-8-unix

Major mode: NEWS

Minor modes in effect:
  async-bytecomp-package-mode: t
  telega-root-auto-fill-mode: t
  telega-active-locations-mode: t
  telega-patrons-mode: t
  outline-minor-mode: t
  global-wakatime-mode: t
  wakatime-mode: t
  popper-echo-mode: t
  popper-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  winner-mode: t
  winum-mode: t
  which-key-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  projectile-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  rime-regexp-mode: t
  prescient-persist-mode: t
  global-ligature-mode: t
  ligature-mode: t
  ns-auto-titlebar-mode: t
  electric-pair-mode: t
  override-global-mode: t
  global-auto-revert-mode: t
  global-so-long-mode: t
  delete-selection-mode: t
  pixel-scroll-precision-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: 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
  button-mode: t

Features:
(shadow sort ecomplete mail-extr cl-print vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs log-view pcvs-util vc jka-compr emacs-news-mode
ielm ido vterm face-remap term disp-table ehelp vterm-module term/xterm
xterm all-the-icons-dired dired-filter dired-hacks-utils dired-x
all-the-icons-ibuffer all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons
data-alltheicons dabbrev pulse consult-xref helpful cc-langs trace
info-look elisp-refs ffap helm-command helm-elisp helm-eval edebug debug
backtrace helm-info helm-mode helm-misc helm-files image-dired
image-dired-tags image-dired-external image-dired-util helm-buffers
helm-occur helm-tags helm-locate helm-types misearch multi-isearch
tramp-archive tramp-gvfs helm-swoop cape consult-vertico consult
compat-28 bookmark helm-grep helm-regexp helm-utils helm-help helm
helm-global-bindings helm-easymenu helm-core async-bytecomp helm-source
helm-multi-match helm-lib helm-swoop-autoloads loaddefs-gen mm-archive
url-cache vc-git diff-mode vc-dispatcher finder-inf kinsoku thai-util
thai-word telega-obsolete telega telega-tdlib-events telega-webpage
visual-fill-column telega-match telega-root telega-info telega-chat
telega-modes image-mode exif telega-company telega-emoji telega-user
telega-notifications notifications dbus telega-voip telega-msg
telega-tme telega-sticker telega-i18n telega-vvnote bindat telega-ffplay
telega-sort telega-filter telega-ins telega-folders telega-inline
telega-util telega-media telega-tdlib rainbow-identifiers org-noter
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 org-download org-element
avl-tree generator org-attach org-id org-refile url-http url-auth url-gw
async org-tempo tempo ob-rust ob-dot ob-haskell ob-python python treesit
ob-sqlite ob-sql ob-C ccls ccls-member-hierarchy
ccls-inheritance-hierarchy ccls-call-hierarchy ccls-tree ccls-code-lens
ccls-semantic-highlight ccls-common lsp-mode lsp-protocol xref spinner
network-stream nsm markdown-mode lv inline imenu ht f f-shortdoc
shortdoc s cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete org-list
org-faces org-entities noutline outline org-version ob-emacs-lisp
ob-core ob-eval org-table oc-basic bibtex ol org-keys oc org-compat
org-macs org-loaddefs cal-menu calendar cal-loaddefs dired-aux ewoc
telega-server telega-core cursor-sensor telega-customize emacsbug
message yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa epg
rfc6068 epg-config mailabbrev gmm-utils mailheader sendmail find-func
vertico-directory wakatime-mode autoinsert popper-echo popper hideshow
hl-todo rainbow-delimiters display-line-numbers tramp-cache time-stamp
tramp-sh tramp tramp-loaddefs trampver tramp-integration cus-edit pp
cus-start files-x tramp-compat shell pcomplete parse-time iso8601
ls-lisp format-spec recentf tree-widget yasnippet winner winum which-key
corfu-popupinfo kind-icon svg-lib color svg dom xml corfu-prescient
corfu marginalia vertico-mouse vertico projectile project grep compile
comint ansi-osc ansi-color ibuf-ext ibuffer ibuffer-loaddefs thingatpt
pcase keyfreq prelude-erc prelude-apps rime-regexp rime rime-predicates
xdg posframe popup dash prelude-mail gnus nnheader gnus-util
text-property-search mail-utils range wid-edit prelude-os prelude-help
prelude-lang-zig prelude-lang-web prelude-lang-agda agda2
prelude-lang-haskell derived prelude-lang-js prelude-lang-ml
prelude-lang-coq prelude-lang-rust prelude-lang-python prelude-lang-cc
prelude-lang-lisp prelude-prog prelude-blog prelude-org prelude-tex
prelude-git prelude-dired prelude-chinese prelude-project
prelude-ibuffer prelude-completion orderless prescient char-fold
prelude-search prelude-workspace prelude-ui ligature ns-auto-titlebar
prelude-core elec-pair use-package-diminish diminish
exec-path-from-shell use-package-ensure undohist edmacro kmacro
use-package-bind-key bind-key easy-mmode autorevert filenotify so-long
delsel no-littering compat compat-macs prelude-benchmark time-date comp
comp-cstr warnings icons advice prelude-common prelude-package
quelpa-use-package cl-extra use-package-core quelpa mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr lisp-mnt monokai-theme pixel-scroll cua-base cus-load
prelude-loaddefs helpful-autoloads geiser-guile-autoloads
eyebrowse-autoloads carbon-now-sh-autoloads benchmark-init-autoloads
company-coq-autoloads elisp-demos-autoloads vertico-prescient-autoloads
kind-icon-autoloads w3m-autoloads pinyinlib-autoloads
lsp-pyright-autoloads autothemer-autoloads org-roam-ui-autoloads
elisp-refs-autoloads cdlatex-autoloads ns-auto-titlebar-autoloads
rime-autoloads highlight-indent-guides-autoloads paredit-autoloads
vterm-autoloads treemacs-all-the-icons-autoloads clhs-autoloads
popper-autoloads merlin-autoloads rainbow-delimiters-autoloads
org-roam-bibtex-autoloads rustic-autoloads xterm-color-autoloads
rust-mode-autoloads yaml-mode-autoloads multiple-cursors-autoloads
websocket-autoloads dired-filter-autoloads auctex-autoloads tex-site
company-math-autoloads zig-mode-autoloads ivy-autoloads
debbugs-autoloads highlight-indentation-autoloads
git-timemachine-autoloads org-noter-autoloads rotate-autoloads
vundo-autoloads diredfl-autoloads embark-consult-autoloads
embark-autoloads nix-mode-autoloads telega-autoloads
rainbow-identifiers-autoloads helm-bibtex-autoloads helm-autoloads
helm-core-autoloads org-download-autoloads async-autoloads
wakatime-mode-autoloads deft-autoloads cmake-mode-autoloads
all-the-icons-dired-autoloads editorconfig-autoloads
python-mode-autoloads dash-at-point-autoloads cape-autoloads
elfeed-autoloads js2-mode-autoloads ripgrep-autoloads
dumb-jump-autoloads rainbow-mode-autoloads blink-search-autoloads
utop-autoloads tuareg-autoloads rx caml-autoloads modus-themes-autoloads
simple-httpd-autoloads company-autoloads which-key-autoloads
org-modern-autoloads quickrun-autoloads geiser-racket-autoloads
geiser-impl help-fns radix-tree help-mode geiser-custom geiser-base ring
geiser-autoloads project-autoloads org-ref-autoloads ox-pandoc-autoloads
citeproc-autoloads queue-autoloads bibtex-completion-autoloads
htmlize-autoloads citre-autoloads speed-type-autoloads
persp-mode-autoloads ccls-autoloads expand-region-autoloads
modern-cpp-font-lock-autoloads cnfonts-autoloads ob-rust-autoloads
biblio-autoloads biblio-core-autoloads org-latex-impatient-autoloads
hyperbole-autoloads undohist-autoloads alert-autoloads gntp-autoloads
string-inflection-autoloads catppuccin-theme-autoloads keyfreq-autoloads
forge-autoloads magit-autoloads git-commit-autoloads
with-editor-autoloads transient-autoloads closql-autoloads
ormolu-autoloads reformatter-autoloads diminish-autoloads
dired-hacks-utils-autoloads wgrep-autoloads diredful-autoloads
meow-autoloads org-appear-autoloads orderless-autoloads
nix-sandbox-autoloads web-mode-autoloads org-roam-autoloads
magit-section-autoloads emacsql-sqlite-autoloads
typescript-mode-autoloads flycheck-haskell-autoloads
haskell-mode-autoloads flycheck-autoloads pkg-info-autoloads
epl-autoloads xref-autoloads power-mode-autoloads
google-translate-autoloads popup-autoloads ghub-autoloads
treepy-autoloads quelpa-use-package-autoloads use-package-autoloads
bind-key-autoloads quelpa-autoloads log4e-autoloads vertico-autoloads
parsebib-autoloads treemacs-projectile-autoloads projectile-autoloads
valign-autoloads visual-fill-column-autoloads smartparens-autoloads
ef-themes-autoloads yasnippet-autoloads corfu-prescient-autoloads
corfu-autoloads hl-todo-autoloads dockerfile-mode-autoloads
dune-autoloads all-the-icons-ibuffer-autoloads all-the-icons-autoloads
math-symbol-lists-autoloads sly-autoloads color-rg-autoloads
typit-autoloads mmt-autoloads go-translate-autoloads nov-autoloads
esxml-autoloads kv-autoloads proof-general-autoloads proof-site
proof-autoloads indent-guide-autoloads pdf-tools-autoloads
tablist-autoloads lsp-ui-autoloads no-littering-autoloads
svg-lib-autoloads doom-themes-autoloads ligature-autoloads
minimap-autoloads prescient-autoloads winum-autoloads
marginalia-autoloads consult-autoloads compat-autoloads
clojure-mode-autoloads emacsql-autoloads dap-mode-autoloads
lsp-docker-autoloads yaml-autoloads lsp-treemacs-autoloads
treemacs-autoloads cfrs-autoloads posframe-autoloads hydra-autoloads
pfuture-autoloads ace-window-autoloads avy-autoloads bui-autoloads
lsp-mode-autoloads lv-autoloads markdown-mode-autoloads
spinner-autoloads ht-autoloads f-autoloads s-autoloads info
dash-autoloads exec-path-from-shell-autoloads monokai-theme-autoloads
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 iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode 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 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
kqueue cocoa ns lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 2641300 697124)
 (symbols 48 62723 10)
 (strings 32 973977 73389)
 (string-bytes 1 47062229)
 (vectors 16 144189)
 (vector-slots 8 3229853 957715)
 (floats 8 83592 5157)
 (intervals 56 19349 30652)
 (buffers 992 44))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 15:13:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60;
 emacs-news-mode does not adjust the width of the fringe to
 accommodate the outline icons
Date: Wed, 30 Nov 2022 17:11:55 +0200
> From: Kai Ma <justksqsf <at> gmail.com>
> Date: Wed, 30 Nov 2022 17:10:40 +0800
> 
> The fringe is too small to accomodate the icons, but emacs-news-mode
> does not adjust the width.  This is especially bad for the 'emoji'
> icons.

Why do you say "fringe"?  AFAICT, nothing here is displayed on the fringes.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 16:27:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Kai Ma <justksqsf <at> gmail.com>, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 17:26:07 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> Why do you say "fringe"?  AFAICT, nothing here is displayed on the
> fringes.

I think Kai meant the icons in "left display margin".

Best, Arash




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 16:42:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 18:41:11 +0200
> The fringe is too small to accomodate the icons, but emacs-news-mode
> does not adjust the width.  This is especially bad for the 'emoji'
> icons.

This is a known limitation of the margin area: its width is limited
to 10 pixels.  This is why in the icon definition outline-open-in-margins
the square icon images are resized to :height 10.  But apparently this
doesn't work for non-image icons.  Maybe there is a setting that
could change the width of window-margins (in pixels)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 17:10:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kai Ma <justksqsf <at> gmail.com>, Juri Linkov <juri <at> linkov.net>
Cc: 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width of
 the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 19:08:39 +0200
> From: Kai Ma <justksqsf <at> gmail.com>
> Date: Thu, 1 Dec 2022 00:11:14 +0800
> Cc: 59719 <at> debbugs.gnu.org
> 
> > On Nov 30, 2022, at 23:11, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > 
> >> From: Kai Ma <justksqsf <at> gmail.com>
> >> Date: Wed, 30 Nov 2022 17:10:40 +0800
> >> 
> >> The fringe is too small to accomodate the icons, but emacs-news-mode
> >> does not adjust the width.  This is especially bad for the 'emoji'
> >> icons.
> > 
> > Why do you say "fringe"?  AFAICT, nothing here is displayed on the fringes.
> 
> I should’ve used “margins”.  I was under the wrong impression that “fringe” is a universal term for “extra spaces around a window”.  Turns out it’s not.  Thanks for correcting me.

OK, thanks.  I thought I was missing something in your report.

Juri, should we seamlessly support arbitrary-size emoji in emacs-news-mode?
If so, we need some code to resize the margins when the emoji are used for
the buttons.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 17:46:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60;
 emacs-news-mode does not adjust the width of the fringe to
 accommodate the outline icons
Date: Wed, 30 Nov 2022 19:44:59 +0200
> Cc: 59719 <at> debbugs.gnu.org
> From: Juri Linkov <juri <at> linkov.net>
> Date: Wed, 30 Nov 2022 18:41:11 +0200
> 
> > The fringe is too small to accomodate the icons, but emacs-news-mode
> > does not adjust the width.  This is especially bad for the 'emoji'
> > icons.
> 
> This is a known limitation of the margin area: its width is limited
> to 10 pixels.

??? The width of the display margin can be controlled by set-window-margins.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 17:57:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 19:56:00 +0200
>> This is a known limitation of the margin area: its width is limited
>> to 10 pixels.
>
> ??? The width of the display margin can be controlled by set-window-margins.

set-window-margins specifies the number of characters.  Maybe need to
set the margin width to more characters if string-width returns more
than 1 character?

But the core problem is that when font size is increased in the buffer,
the margin pixel size doesn't increase proportionally.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 18:16:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 20:15:01 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: justksqsf <at> gmail.com,  59719 <at> debbugs.gnu.org
> Date: Wed, 30 Nov 2022 19:56:00 +0200
> 
> >> This is a known limitation of the margin area: its width is limited
> >> to 10 pixels.
> >
> > ??? The width of the display margin can be controlled by set-window-margins.
> 
> set-window-margins specifies the number of characters.

Yes.  But that's not a problem: you can ask for 2 or 3 characters, as
needed.

> Maybe need to set the margin width to more characters if string-width
> returns more than 1 character?

Why not use string-pixel-width, and divide by what default-font-width
returns?

> But the core problem is that when font size is increased in the buffer,
> the margin pixel size doesn't increase proportionally.

This is how the margins were designed: they never resize automatically.  It
is up to the Lisp program to do that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 18:32:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 20:30:16 +0200
>> set-window-margins specifies the number of characters.
>
> Yes.  But that's not a problem: you can ask for 2 or 3 characters, as
> needed.
>
>> Maybe need to set the margin width to more characters if string-width
>> returns more than 1 character?
>
> Why not use string-pixel-width, and divide by what default-font-width
> returns?

This means to iterate over all icons and get their maximal width.

>> But the core problem is that when font size is increased in the buffer,
>> the margin pixel size doesn't increase proportionally.
>
> This is how the margins were designed: they never resize automatically.  It
> is up to the Lisp program to do that.

There is one thing that I don't understand about margins: could you clarify
how the default width of a character cell is calculated?  Is it based
on the default font size?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 18:45:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 20:44:07 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: justksqsf <at> gmail.com,  59719 <at> debbugs.gnu.org
> Date: Wed, 30 Nov 2022 20:30:16 +0200
> 
> > Why not use string-pixel-width, and divide by what default-font-width
> > returns?
> 
> This means to iterate over all icons and get their maximal width.

Are they so different in their dimensions?  And how many icons do we have in
this case?

> There is one thing that I don't understand about margins: could you clarify
> how the default width of a character cell is calculated?  Is it based
> on the default font size?

Yes, based on the default face's font.  Exactly like the dimensions of the
text-area of the window are calculated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 18:49:02 GMT) Full text and rfc822 format available.

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

From: Kai Ma <justksqsf <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width of
 the fringe to accommodate the outline icons
Date: Thu, 1 Dec 2022 00:11:14 +0800
> On Nov 30, 2022, at 23:11, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Kai Ma <justksqsf <at> gmail.com>
>> Date: Wed, 30 Nov 2022 17:10:40 +0800
>> 
>> The fringe is too small to accomodate the icons, but emacs-news-mode
>> does not adjust the width.  This is especially bad for the 'emoji'
>> icons.
> 
> Why do you say "fringe"?  AFAICT, nothing here is displayed on the fringes.

I should’ve used “margins”.  I was under the wrong impression that “fringe” is a universal term for “extra spaces around a window”.  Turns out it’s not.  Thanks for correcting me.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 19:02:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 20:59:56 +0200
>> > Why not use string-pixel-width, and divide by what default-font-width
>> > returns?
>>
>> This means to iterate over all icons and get their maximal width.
>
> Are they so different in their dimensions?  And how many icons do we have in
> this case?

5 icons.

>> There is one thing that I don't understand about margins: could you clarify
>> how the default width of a character cell is calculated?  Is it based
>> on the default font size?
>
> Yes, based on the default face's font.  Exactly like the dimensions of the
> text-area of the window are calculated.

Strange, when adjusting text-scale with 'C-x C-+' the width of the
margins doesn't change together with the font size of the buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Wed, 30 Nov 2022 20:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Wed, 30 Nov 2022 22:19:13 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: justksqsf <at> gmail.com,  59719 <at> debbugs.gnu.org
> Date: Wed, 30 Nov 2022 20:59:56 +0200
> 
> >> > Why not use string-pixel-width, and divide by what default-font-width
> >> > returns?
> >>
> >> This means to iterate over all icons and get their maximal width.
> >
> > Are they so different in their dimensions?  And how many icons do we have in
> > this case?
> 
> 5 icons.

So it isn't terrible to measure all of them and find the widest one.

> Strange, when adjusting text-scale with 'C-x C-+' the width of the
> margins doesn't change together with the font size of the buffer.

Why should it?  Like I said: the margins don't automatically change their
dimensions.

But try activating linum-mode first, and then play with buffer font's size.




Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 01 Dec 2022 13:26:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Thu, 01 Dec 2022 18:55:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Thu, 01 Dec 2022 20:51:02 +0200
[Message part 1 (text/plain, inline)]
> Why not use string-pixel-width, and divide by what default-font-width
> returns?

Here is the complete tested fix:

[outline-margin-width.patch (text/x-diff, inline)]
diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el
index 86c44830308..8ba6d97ea00 100644
--- a/lisp/emacs-lisp/icons.el
+++ b/lisp/emacs-lisp/icons.el
@@ -202,6 +202,10 @@ icons--create
                       (list :height (if (eq height 'line)
                                         (window-default-line-height)
                                       height)))
+                  (if-let ((width (plist-get keywords :width)))
+                      (list :width (if (eq width 'font)
+                                       (default-font-width)
+                                     width)))
                   '(:scale 1)
                   (if-let ((rotation (plist-get keywords :rotation)))
                       (list :rotation rotation))
diff --git a/lisp/outline.el b/lisp/outline.el
index 86ac19aa415..b50f4f81b62 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -318,8 +319,14 @@ outline--button-icons
 (defvar-local outline--use-rtl nil
   "Non-nil when direction of clickable buttons is right-to-left.")
 
+(defvar-local outline--margin-width nil
+  "Current margin width.")
+
+(defvar-local outline-margin-width nil
+  "Default margin width.")
+
 (define-icon outline-open nil
-  '((image "outline-open.svg" "outline-open.pbm" :height (0.8 . em))
+  '((image "outline-open.svg" "outline-open.pbm" :width (0.8 . em))
     (emoji "🔽")
     (symbol " ▼ ")
     (text " open "))
@@ -328,7 +335,7 @@ outline-open
   :help-echo "Close this section")
 
 (define-icon outline-close nil
-  '((image "outline-close.svg" "outline-close.pbm" :height (0.8 . em))
+  '((image "outline-close.svg" "outline-close.pbm" :width (0.8 . em))
     (emoji "▶️")
     (symbol " ▶ ")
     (text " close "))
@@ -337,15 +344,14 @@ outline-close
   :help-echo "Open this section")
 
 (define-icon outline-close-rtl outline-close
-  '((image "outline-close.svg" "outline-close.pbm" :height (0.8 . em)
-           :rotation 180)
+  '((image "outline-close.svg" "outline-close.pbm" :width (0.8 . em) :rotation 180)
     (emoji "◀️")
     (symbol " ◀ "))
   "Right-to-left icon used for buttons in closed outline sections."
   :version "29.1")
 
 (define-icon outline-open-in-margins outline-open
-  '((image "outline-open.svg" "outline-open.pbm" :height 10)
+  '((image "outline-open.svg" "outline-open.pbm" :width font)
     (emoji "🔽")
     (symbol "▼")
     (text "v"))
@@ -353,7 +359,7 @@ outline-open-in-margins
   :version "29.1")
 
 (define-icon outline-close-in-margins outline-close
-  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation -90)
+  '((image "outline-open.svg" "outline-open.pbm" :width font :rotation -90)
     (emoji "▶️")
     (symbol "▶")
     (text ">"))
@@ -361,7 +367,7 @@ outline-close-in-margins
   :version "29.1")
 
 (define-icon outline-close-rtl-in-margins outline-close-rtl
-  '((image "outline-open.svg" "outline-open.pbm" :height 10 :rotation 90)
+  '((image "outline-open.svg" "outline-open.pbm" :width font :rotation 90)
     (emoji "◀️")
     (symbol "◀")
     (text "<"))
@@ -528,9 +534,22 @@ outline-minor-mode
           (when (and (eq outline-minor-mode-use-buttons 'in-margins)
                      (> 1 (if outline--use-rtl right-margin-width
                             left-margin-width)))
+            (setq outline--margin-width
+                  (or outline-margin-width
+                      (ceiling
+                       (/ (seq-max
+                           (seq-map #'string-pixel-width
+                                    (seq-map #'icon-string
+                                             `(outline-open-in-margins
+                                               ,(if 'outline--use-rtl
+                                                    'outline-close-rtl-in-margins
+                                                  'outline-close-in-margins)))))
+                          (* (default-font-width) 1.0)))))
             (if outline--use-rtl
-                (setq-local right-margin-width (1+ right-margin-width))
-              (setq-local left-margin-width (1+ left-margin-width)))
+                (setq-local right-margin-width (+ right-margin-width
+                                                  outline--margin-width))
+              (setq-local left-margin-width (+ left-margin-width
+                                               outline--margin-width)))
             (setq-local fringes-outside-margins t)
             ;; Force display of margins
             (when (eq (current-buffer) (window-buffer))
@@ -566,8 +587,10 @@ outline-minor-mode
                  (< 0 (if outline--use-rtl right-margin-width
                         left-margin-width)))
         (if outline--use-rtl
-            (setq-local right-margin-width (1- right-margin-width))
-          (setq-local left-margin-width (1- left-margin-width)))
+            (setq-local right-margin-width (- right-margin-width
+                                              outline--margin-width))
+          (setq-local left-margin-width (- left-margin-width
+                                           outline--margin-width)))
         (setq-local fringes-outside-margins nil)
         ;; Force removal of margins
         (when (eq (current-buffer) (window-buffer))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59719; Package emacs. (Thu, 01 Dec 2022 20:11:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: justksqsf <at> gmail.com, 59719 <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Thu, 01 Dec 2022 22:09:50 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: justksqsf <at> gmail.com,  59719 <at> debbugs.gnu.org
> Date: Thu, 01 Dec 2022 20:51:02 +0200
> 
> > Why not use string-pixel-width, and divide by what default-font-width
> > returns?
> 
> Here is the complete tested fix:

Thanks, LGTM.




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Fri, 02 Dec 2022 07:56:01 GMT) Full text and rfc822 format available.

Notification sent to Kai Ma <justksqsf <at> gmail.com>:
bug acknowledged by developer. (Fri, 02 Dec 2022 07:56:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: justksqsf <at> gmail.com, 59719-done <at> debbugs.gnu.org
Subject: Re: bug#59719: 29.0.60; emacs-news-mode does not adjust the width
 of the fringe to accommodate the outline icons
Date: Fri, 02 Dec 2022 09:54:49 +0200
>> > Why not use string-pixel-width, and divide by what default-font-width
>> > returns?
>> 
>> Here is the complete tested fix:
>
> Thanks, LGTM.

So now pushed to emacs-29 and closed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 30 Dec 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 230 days ago.

Previous Next


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