unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
@ 2022-11-30  9:10 Kai Ma
  2022-11-30 15:11 ` Eli Zaretskii
  2022-11-30 16:41 ` Juri Linkov
  0 siblings, 2 replies; 16+ messages in thread
From: Kai Ma @ 2022-11-30  9:10 UTC (permalink / raw)
  To: 59719

[-- Attachment #1: Type: text/plain, Size: 160 bytes --]


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:


[-- Attachment #2: emacs-symbol.png --]
[-- Type: image/png, Size: 49895 bytes --]

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


Text icons:


[-- Attachment #4: emacs-text.png --]
[-- Type: image/png, Size: 43798 bytes --]

[-- Attachment #5: Type: text/plain, Size: 15 bytes --]


Emoji icons:


[-- Attachment #6: emacs-emoji.png --]
[-- Type: image/png, Size: 30983 bytes --]

[-- Attachment #7: Type: text/plain, Size: 33 bytes --]


Also reproducible on emacs -Q:


[-- Attachment #8: emacs-Q.png --]
[-- Type: image/png, Size: 475419 bytes --]

[-- Attachment #9: Type: text/plain, Size: 12527 bytes --]



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))

^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30  9:10 bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons Kai Ma
@ 2022-11-30 15:11 ` Eli Zaretskii
  2022-11-30 16:11   ` Kai Ma
  2022-11-30 16:26   ` Arash Esbati
  2022-11-30 16:41 ` Juri Linkov
  1 sibling, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2022-11-30 15:11 UTC (permalink / raw)
  To: Kai Ma; +Cc: 59719

> From: Kai Ma <justksqsf@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 15:11 ` Eli Zaretskii
@ 2022-11-30 16:11   ` Kai Ma
  2022-11-30 17:08     ` Eli Zaretskii
  2022-11-30 16:26   ` Arash Esbati
  1 sibling, 1 reply; 16+ messages in thread
From: Kai Ma @ 2022-11-30 16:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 59719


> On Nov 30, 2022, at 23:11, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Kai Ma <justksqsf@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.






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 15:11 ` Eli Zaretskii
  2022-11-30 16:11   ` Kai Ma
@ 2022-11-30 16:26   ` Arash Esbati
  1 sibling, 0 replies; 16+ messages in thread
From: Arash Esbati @ 2022-11-30 16:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Kai Ma, 59719

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30  9:10 bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons Kai Ma
  2022-11-30 15:11 ` Eli Zaretskii
@ 2022-11-30 16:41 ` Juri Linkov
  2022-11-30 17:44   ` Eli Zaretskii
  1 sibling, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-11-30 16:41 UTC (permalink / raw)
  To: Kai Ma; +Cc: 59719

> 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)?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 16:11   ` Kai Ma
@ 2022-11-30 17:08     ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2022-11-30 17:08 UTC (permalink / raw)
  To: Kai Ma, Juri Linkov; +Cc: 59719

> From: Kai Ma <justksqsf@gmail.com>
> Date: Thu, 1 Dec 2022 00:11:14 +0800
> Cc: 59719@debbugs.gnu.org
> 
> > On Nov 30, 2022, at 23:11, Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> >> From: Kai Ma <justksqsf@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 16:41 ` Juri Linkov
@ 2022-11-30 17:44   ` Eli Zaretskii
  2022-11-30 17:56     ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-11-30 17:44 UTC (permalink / raw)
  To: Juri Linkov; +Cc: justksqsf, 59719

> Cc: 59719@debbugs.gnu.org
> From: Juri Linkov <juri@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 17:44   ` Eli Zaretskii
@ 2022-11-30 17:56     ` Juri Linkov
  2022-11-30 18:15       ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-11-30 17:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justksqsf, 59719

>> 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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 17:56     ` Juri Linkov
@ 2022-11-30 18:15       ` Eli Zaretskii
  2022-11-30 18:30         ` Juri Linkov
  2022-12-01 18:51         ` Juri Linkov
  0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2022-11-30 18:15 UTC (permalink / raw)
  To: Juri Linkov; +Cc: justksqsf, 59719

> From: Juri Linkov <juri@linkov.net>
> Cc: justksqsf@gmail.com,  59719@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 18:15       ` Eli Zaretskii
@ 2022-11-30 18:30         ` Juri Linkov
  2022-11-30 18:44           ` Eli Zaretskii
  2022-12-01 18:51         ` Juri Linkov
  1 sibling, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-11-30 18:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justksqsf, 59719

>> 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?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 18:30         ` Juri Linkov
@ 2022-11-30 18:44           ` Eli Zaretskii
  2022-11-30 18:59             ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-11-30 18:44 UTC (permalink / raw)
  To: Juri Linkov; +Cc: justksqsf, 59719

> From: Juri Linkov <juri@linkov.net>
> Cc: justksqsf@gmail.com,  59719@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 18:44           ` Eli Zaretskii
@ 2022-11-30 18:59             ` Juri Linkov
  2022-11-30 20:19               ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-11-30 18:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justksqsf, 59719

>> > 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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 18:59             ` Juri Linkov
@ 2022-11-30 20:19               ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2022-11-30 20:19 UTC (permalink / raw)
  To: Juri Linkov; +Cc: justksqsf, 59719

> From: Juri Linkov <juri@linkov.net>
> Cc: justksqsf@gmail.com,  59719@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-11-30 18:15       ` Eli Zaretskii
  2022-11-30 18:30         ` Juri Linkov
@ 2022-12-01 18:51         ` Juri Linkov
  2022-12-01 20:09           ` Eli Zaretskii
  1 sibling, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-12-01 18:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justksqsf, 59719

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]

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

Here is the complete tested fix:


[-- Attachment #2: outline-margin-width.patch --]
[-- Type: text/x-diff, Size: 5265 bytes --]

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))

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-12-01 18:51         ` Juri Linkov
@ 2022-12-01 20:09           ` Eli Zaretskii
  2022-12-02  7:54             ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-12-01 20:09 UTC (permalink / raw)
  To: Juri Linkov; +Cc: justksqsf, 59719

> From: Juri Linkov <juri@linkov.net>
> Cc: justksqsf@gmail.com,  59719@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons
  2022-12-01 20:09           ` Eli Zaretskii
@ 2022-12-02  7:54             ` Juri Linkov
  0 siblings, 0 replies; 16+ messages in thread
From: Juri Linkov @ 2022-12-02  7:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: justksqsf, 59719-done

>> > 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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-12-02  7:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30  9:10 bug#59719: 29.0.60; emacs-news-mode does not adjust the width of the fringe to accommodate the outline icons Kai Ma
2022-11-30 15:11 ` Eli Zaretskii
2022-11-30 16:11   ` Kai Ma
2022-11-30 17:08     ` Eli Zaretskii
2022-11-30 16:26   ` Arash Esbati
2022-11-30 16:41 ` Juri Linkov
2022-11-30 17:44   ` Eli Zaretskii
2022-11-30 17:56     ` Juri Linkov
2022-11-30 18:15       ` Eli Zaretskii
2022-11-30 18:30         ` Juri Linkov
2022-11-30 18:44           ` Eli Zaretskii
2022-11-30 18:59             ` Juri Linkov
2022-11-30 20:19               ` Eli Zaretskii
2022-12-01 18:51         ` Juri Linkov
2022-12-01 20:09           ` Eli Zaretskii
2022-12-02  7:54             ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).