* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
@ 2022-05-12 15:33 Joost Kremers
2022-05-13 12:52 ` Lars Ingebrigtsen
0 siblings, 1 reply; 19+ messages in thread
From: Joost Kremers @ 2022-05-12 15:33 UTC (permalink / raw)
To: 55387
`csv-mode` has the option to display a header line so you can make column names
permanently visible, which is a very nice option. However, when
`display-line-numbers-mode` is active, the column names do not line up with the
actual columns, because the header line does not take into account the space
taken up by the line numbers.
I posted this on emacs-devel:
<https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg01308.html>
Eli Zaretskii suggested this can be fixed by doing something similar to what
tabulated-list-mode does. I'm not sure I'll find time to dive into that any time
soon, so I'm posting here to make sure the issue isn't forgotten.
Joost
In GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2022-04-04 built on Lenovo
Repository revision: dd3863d8bcc77c43363bbd041da1c1eb37a3ee32
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: elementary OS 6.1 Jólnir
Configured using:
'configure --with-harfbuzz --with-cairo --with-json --with-libgmp
--with-native-compilation'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
XIM XPM GTK3 ZLIB
Important settings:
value of $LC_MONETARY: en_IE.UTF-8
value of $LC_NUMERIC: en_IE.UTF-8
value of $LC_TIME: en_IE.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: VTerm
Minor modes in effect:
flycheck-indicator-mode: t
minions-mode: t
doom-modeline-mode: t
which-key-mode: t
global-atomic-chrome-edit-mode: t
marginalia-mode: t
all-the-icons-completion-mode: t
company-prescient-mode: t
selectrum-prescient-mode: t
prescient-persist-mode: t
projectile-mode: t
global-diff-hl-mode: t
global-git-commit-mode: t
csv-field-index-mode: t
shell-dirtrack-mode: t
company-quickhelp-mode: t
company-quickhelp-local-mode: t
global-company-mode: t
company-mode: t
electric-pair-mode: t
recentf-mode: t
delete-selection-mode: t
override-global-mode: t
ctrlf-mode: t
ctrlf-local-mode: t
selectrum-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-save-visited-mode: t
Load-path shadows:
~/.emacs.d/lisp/custom hides /usr/local/share/emacs/28.1.50/lisp/custom
/home/joost/.emacs.d/elpa/transient-20220509.1943/transient hides /usr/local/share/emacs/28.1.50/lisp/transient
Features:
(shadow emacsbug gnus-fun shr-color calc-misc calc-arith calc-alg calc-ext
calc-menu calc calc-loaddefs calc-macs vc-mtn vc-hg vc-git vc-bzr vc-src vc-sccs
vc-cvs vc-rcs consult-selectrum consult compat-28 mc-edit-lines wdired dired-aux
pcmpl-unix em-unix em-term em-script em-prompt em-ls em-hist em-pred em-glob
em-cmpl em-dirs esh-var em-basic em-banner em-alias esh-mode char-fold
display-fill-column-indicator flycheck-indicator org-autolist org-indent ol-eww
eww xdg mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search
eieio-opt speedbar ezimage dframe ol-docview ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi avy gnus-icalendar org-capture org-refile icalendar diary-lib
diary-loaddefs qp smiley gnus-cite mail-extr visual-fill-column
display-line-numbers mu4e-settings gnus-dired mu4e mu4e-org mu4e-main mu4e-view
mu4e-view-gnus gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum
gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader
mu4e-view-common mu4e-headers mu4e-compose mu4e-context mu4e-draft mu4e-actions
rfc2368 smtpmail sendmail mu4e-mark mu4e-proc mu4e-utils doc-view jka-compr
image-mode exif mu4e-lists mu4e-message flow-fill mu4e-vars mu4e-meta async
mm-archive mule-util gnutls url-cache finder-inf jk-input-methods quail wgrep-ag
wgrep flycheck-ledger vterm bookmark term disp-table ehelp vterm-module
term/xterm xterm ielm minions doom-modeline doom-modeline-segments
doom-modeline-env doom-modeline-core shrink-path which-key atomic-chrome iimage
image+ image-file image-converter ctrlf marginalia all-the-icons-completion
company-prescient selectrum-prescient selectrum minibuf-eldef prescient
dockerfile-mode sh-script smie executable impatient-mode htmlize tide tide-lv
typescript-mode indium indium-list-sources indium-scratch indium-interaction
indium-chrome indium-nodejs indium-repl indium-debugger indium-debugger-litable
js2-refactor js2r-paredit js2r-conveniences js2r-conditionals js2r-wrapping
js2r-functions js2r-vars mc-hide-unmatched-lines-mode mc-mark-more
mc-cycle-cursors multiple-cursors-core rect js2r-iife js2r-formatting
js2r-helpers indium-debugger-locals indium-breakpoint indium-inspector
indium-render indium-faces indium-seq-fix indium-client indium-structs
json-process-client js2-mode js cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs jupyter python-pytest lsp-pyright
dap-python paredit flycheck-clj-kondo sesman clojure-mode align dap-mode
dap-launch dap-overlays eldoc-box jsonrpc ert debug backtrace lsp-ui
lsp-ui-flycheck lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline
flycheck-posframe flycheck lsp-mode network-stream markdown-mode inline imenu f
lsp-ui-util face-remap lsp-protocol ht ag vc-svn find-dired s projectile
lisp-mnt grep compile ibuf-ext ibuffer ibuffer-loaddefs thingatpt diff-hl
log-view vc-dir ewoc vc vc-dispatcher diff-mode git-commit magit-git magit-base
magit-section crm compat-27 compat-26 with-editor transient compat log-edit
message rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log autorevert filenotify aggressive-indent nswbuff
yaml-mode yaml guess-language flyspell ispell dired dired-loaddefs reftex
reftex-loaddefs reftex-vars csv-mode sort tab-jump-out yasnippet-snippets
yasnippet company-org-block org-element avl-tree org-settings org-clock
ob-jupyter jupyter-tramp jupyter-server jupyter-server-ioloop
jupyter-ioloop-comm jupyter-ioloop zmq zmq-core jupyter-rest-api url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw
nsm rmc jupyter-org-extensions jupyter-org-client jupyter-repl
jupyter-kernel-manager jupyter-channel jupyter-widget-client websocket bindat
simple-httpd jupyter-client jupyter-comm-layer jupyter-messages hmac-def
jupyter-mime shr kinsoku text-property-search puny svg dom jupyter-kernelspec
jupyter-env jupyter-base eieio-base ob-shell ob-scheme ob-clojure ob-python
python tramp-sh 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 ol
org-keys oc org-compat org-macs org-loaddefs find-func cal-menu calendar
cal-loaddefs docker-tramp tramp-cache tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete comint ansi-color
parse-time ls-lisp format-spec biblio biblio-download biblio-dissemin
biblio-ieee biblio-hal biblio-dblp biblio-crossref biblio-arxiv timezone
biblio-doi biblio-core let-alist url-queue ido hl-line bibtex iso8601 time-date
adaptive-wrap goggles comp comp-cstr warnings pulse posframe bm
company-quickhelp pos-tip all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons data-alltheicons
company-keywords company-etags etags fileloop generator xref project
company-gtags company-dabbrev-code company-dabbrev company-ipa company-files
company-clang company-cmake company-semantic company-template company-css
company-capf company pcase solarized-light-theme solarized-theme solarized
solarized-faces color paradox paradox-menu paradox-commit-list hydra ring lv
cus-edit pp cus-load paradox-execute paradox-github paradox-core spinner dash
cl-extra help-mode jk-functions advice eshell esh-cmd esh-ext esh-opt esh-proc
esh-io esh-arg esh-module esh-groups esh-util notifications dbus xml edmacro
kmacro server elec-pair recentf tree-widget wid-edit delsel use-package
use-package-ensure use-package-delight use-package-diminish use-package-bind-key
bind-key use-package-core tex-site rx realgud-recursive-autoloads easy-mmode
info package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json
subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs
cl-lib iso-transl tooltip 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 cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese composite
emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple
abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk
x-toolkit x multi-tty make-network-process native-compile emacs)
Memory information:
((conses 16 2507671 210461)
(symbols 48 75183 82)
(strings 32 389951 32176)
(string-bytes 1 15471027)
(vectors 16 134357)
(vector-slots 8 2471944 157675)
(floats 8 1840 1637)
(intervals 56 237674 14841)
(buffers 992 29))
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-12 15:33 bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed Joost Kremers
@ 2022-05-13 12:52 ` Lars Ingebrigtsen
2022-05-13 13:36 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 12:52 UTC (permalink / raw)
To: Joost Kremers; +Cc: Eli Zaretskii, 55387
Joost Kremers <joostkremers@fastmail.fm> writes:
> Eli Zaretskii suggested this can be fixed by doing something similar
> to what tabulated-list-mode does. I'm not sure I'll find time to dive
> into that any time soon, so I'm posting here to make sure the issue
> isn't forgotten.
I had a look at what tabulated-list-mode does, and it's a lot of code.
(And it doesn't really work well -- toggling the line numbers on and
then off again doesn't restore the column names).
I'm surprised that that's necessary -- surely
`display-line-numbers-mode' should itself fix up the header line? That
is, there should be a header line format construct that modes can add to
the front of `header-line-format' that's controlled by
`display-line-numbers-mode'.
Eli, does this sound like a plan to you?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 12:52 ` Lars Ingebrigtsen
@ 2022-05-13 13:36 ` Eli Zaretskii
2022-05-13 13:41 ` Lars Ingebrigtsen
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-13 13:36 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 55387@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> Date: Fri, 13 May 2022 14:52:21 +0200
>
> I'm surprised that that's necessary -- surely
> `display-line-numbers-mode' should itself fix up the header line? That
> is, there should be a header line format construct that modes can add to
> the front of `header-line-format' that's controlled by
> `display-line-numbers-mode'.
>
> Eli, does this sound like a plan to you?
I don't think I understand how this could work. The line-number width
is not fixed, it changes dynamically as needed. How would the
header-line adapt itself, except in some hook that is called by
redisplay?
Also, display-line-numbers-mode is not really a mode, in the sense
that there's no mode-specific code anywhere. It's basically a
variable that tells redisplay to do or not do something. So I don't
think I understand how can this "mode" control anything?
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 13:36 ` Eli Zaretskii
@ 2022-05-13 13:41 ` Lars Ingebrigtsen
2022-05-13 14:12 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 13:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Eli Zaretskii <eliz@gnu.org> writes:
> I don't think I understand how this could work. The line-number width
> is not fixed, it changes dynamically as needed. How would the
> header-line adapt itself, except in some hook that is called by
> redisplay?
header-line-format would look like
(display-line-spaces <the rest>)
where display-line-spaces would indeed be updated by the redisplay code
(to be of the same length as (line-number-display-width 'columns)).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 13:41 ` Lars Ingebrigtsen
@ 2022-05-13 14:12 ` Eli Zaretskii
2022-05-13 14:20 ` Eli Zaretskii
2022-05-13 15:52 ` Lars Ingebrigtsen
0 siblings, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-13 14:12 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 15:41:50 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > I don't think I understand how this could work. The line-number width
> > is not fixed, it changes dynamically as needed. How would the
> > header-line adapt itself, except in some hook that is called by
> > redisplay?
>
> header-line-format would look like
>
> (display-line-spaces <the rest>)
>
> where display-line-spaces would indeed be updated by the redisplay code
> (to be of the same length as (line-number-display-width 'columns)).
This last bit is what I don't understand. Redisplay code works one
screen line at a time, and it does that from the highest line to the
lowest line ("highest" and "lowest" don't necessarily mean the first
and the last visible lines in a window, they could mean line number N
and line number M, where N <= M). When (and if) it displays the
header-line, it doesn't yet know that the lines showing text will need
a wider line-number display; it will know that only when it works on
the first screen line of text it was asked to display. And when it
displays a screen line of text, it doesn't consider
header-line-format, not even whether the window has a header-line.
Moreover, the code which produces the line-numbers can be called when
the line doesn't need to be displayed at all, only its metrics
measured, for some job related to layout of text. In this case, it
would be unthinkable to modify the header-line as a side effect,
because no one expects the header-line to be updated on display when,
say, the user presses C-n in the middle of a window.
So again, I don't understand how this can work.
This is why we have hooks that redisplay calls in strategic places,
and tabulated-list.el uses them to update the header-line. Why isn't
that a better way?
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 14:12 ` Eli Zaretskii
@ 2022-05-13 14:20 ` Eli Zaretskii
2022-05-13 15:55 ` Eli Zaretskii
2022-05-13 15:52 ` Lars Ingebrigtsen
1 sibling, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-13 14:20 UTC (permalink / raw)
To: larsi; +Cc: joostkremers, 55387
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 17:12:03 +0300
> From: Eli Zaretskii <eliz@gnu.org>
>
> > header-line-format would look like
> >
> > (display-line-spaces <the rest>)
> >
> > where display-line-spaces would indeed be updated by the redisplay code
> > (to be of the same length as (line-number-display-width 'columns)).
Btw, isn't it true that the problem is not in displaying the
header-line, but in adjusting the alignment of the _body_ of the table
to the changes in header-line (which happen automatically)? In which
case how will header-line construct help?
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 14:20 ` Eli Zaretskii
@ 2022-05-13 15:55 ` Eli Zaretskii
0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-13 15:55 UTC (permalink / raw)
To: larsi, joostkremers; +Cc: 55387
> Resent-From: Eli Zaretskii <eliz@gnu.org>
> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
> Resent-CC: bug-gnu-emacs@gnu.org
> Resent-Sender: help-debbugs@gnu.org
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 17:20:43 +0300
> From: Eli Zaretskii <eliz@gnu.org>
>
> > Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> > Date: Fri, 13 May 2022 17:12:03 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> >
> > > header-line-format would look like
> > >
> > > (display-line-spaces <the rest>)
> > >
> > > where display-line-spaces would indeed be updated by the redisplay code
> > > (to be of the same length as (line-number-display-width 'columns)).
>
> Btw, isn't it true that the problem is not in displaying the
> header-line, but in adjusting the alignment of the _body_ of the table
> to the changes in header-line (which happen automatically)? In which
> case how will header-line construct help?
So looking at cvs-mode.el, I conclude that I don't really understand
the problem. It seems to use :align-to display spec to align columns
in the body of the table, which should keep the alignment when
line-numbers are turned on and off, so is the problem with the
header-line after all? If so, why isn't just using
line-number-display-width when calculating the header-line-format good
enough?
Perhaps Joost could describe the problem in more detail?
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 14:12 ` Eli Zaretskii
2022-05-13 14:20 ` Eli Zaretskii
@ 2022-05-13 15:52 ` Lars Ingebrigtsen
2022-05-13 16:01 ` Eli Zaretskii
1 sibling, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 15:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Eli Zaretskii <eliz@gnu.org> writes:
> Moreover, the code which produces the line-numbers can be called when
> the line doesn't need to be displayed at all, only its metrics
> measured, for some job related to layout of text. In this case, it
> would be unthinkable to modify the header-line as a side effect,
> because no one expects the header-line to be updated on display when,
> say, the user presses C-n in the middle of a window.
>
> So again, I don't understand how this can work.
I don't really understand your point here, so I'm probably
misunderstanding something fundamental. My thought was just that the
thing that produces the line number would set a
line-number-width/columns variable. When redisplay formats the header
line (whenever it wants to do that), that variable would be set, so it
would just render it in the totally normal way.
> This is why we have hooks that redisplay calls in strategic places,
> and tabulated-list.el uses them to update the header-line. Why isn't
> that a better way?
Because this affects all modes that have a columnar layout and uses a
header line.
> Btw, isn't it true that the problem is not in displaying the
> header-line, but in adjusting the alignment of the _body_ of the table
> to the changes in header-line (which happen automatically)? In which
> case how will header-line construct help?
The header line isn't adjusted automatically by display-line-number-mode.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 15:52 ` Lars Ingebrigtsen
@ 2022-05-13 16:01 ` Eli Zaretskii
2022-05-13 16:04 ` Lars Ingebrigtsen
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-13 16:01 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 17:52:11 +0200
>
> I don't really understand your point here, so I'm probably
> misunderstanding something fundamental. My thought was just that the
> thing that produces the line number would set a
> line-number-width/columns variable.
There's no such variable. line-number-display-width is a function, it
computes the result anew when called.
> > Btw, isn't it true that the problem is not in displaying the
> > header-line, but in adjusting the alignment of the _body_ of the table
> > to the changes in header-line (which happen automatically)? In which
> > case how will header-line construct help?
>
> The header line isn't adjusted automatically by display-line-number-mode.
Does the problem happen only when display-line-number-mode is turned
on or off? Or does it happen on other occasions, and if so, which
ones?
And what triggers recalculation of the header-line-format in this
mode? That trigger is different between different users of modes like
this one, so coming up with a one-fits-all solution is not easy, if at
all possible.
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 16:01 ` Eli Zaretskii
@ 2022-05-13 16:04 ` Lars Ingebrigtsen
2022-05-13 17:09 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 16:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Eli Zaretskii <eliz@gnu.org> writes:
>> I don't really understand your point here, so I'm probably
>> misunderstanding something fundamental. My thought was just that the
>> thing that produces the line number would set a
>> line-number-width/columns variable.
>
> There's no such variable. line-number-display-width is a function, it
> computes the result anew when called.
I know. We would introduce such a variable and (offer to) use it in
header-line-mode.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 16:04 ` Lars Ingebrigtsen
@ 2022-05-13 17:09 ` Eli Zaretskii
2022-05-13 17:40 ` Lars Ingebrigtsen
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-13 17:09 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 18:04:08 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> I don't really understand your point here, so I'm probably
> >> misunderstanding something fundamental. My thought was just that the
> >> thing that produces the line number would set a
> >> line-number-width/columns variable.
> >
> > There's no such variable. line-number-display-width is a function, it
> > computes the result anew when called.
>
> I know. We would introduce such a variable and (offer to) use it in
> header-line-mode.
That's impossible, because the value depends on the buffer position.
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 17:09 ` Eli Zaretskii
@ 2022-05-13 17:40 ` Lars Ingebrigtsen
2022-05-13 17:41 ` Lars Ingebrigtsen
2022-05-14 5:17 ` Eli Zaretskii
0 siblings, 2 replies; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 17:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Eli Zaretskii <eliz@gnu.org> writes:
>> I know. We would introduce such a variable and (offer to) use it in
>> header-line-mode.
>
> That's impossible, because the value depends on the buffer position.
We only care about the value of the first (displayed) line after the
header line, so the new variable would only be updated when we're
computing that line. I.e., line 1.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 17:40 ` Lars Ingebrigtsen
@ 2022-05-13 17:41 ` Lars Ingebrigtsen
2022-05-13 18:14 ` Lars Ingebrigtsen
2022-05-14 5:17 ` Eli Zaretskii
1 sibling, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 17:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Lars Ingebrigtsen <larsi@gnus.org> writes:
> We only care about the value of the first (displayed) line after the
> header line, so the new variable would only be updated when we're
> computing that line. I.e., line 1.
(Visual line 1 in the window, of course, not the buffer line 1...)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 17:41 ` Lars Ingebrigtsen
@ 2022-05-13 18:14 ` Lars Ingebrigtsen
2022-05-13 19:48 ` Lars Ingebrigtsen
0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 18:14 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
On the other hand, factoring out the code in tabulated-list.el into its
own little minor mode -- say, `header-line-indent-mode' -- looks like it
would be pretty easy, and not involve any complicated state, too. (It
just runs off of pre-redisplay-functions/window-scroll-functions.)
As a bonus it doesn't require that that modes change their
header-line-format variables, I think.
I'll take a stab at doing that.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 18:14 ` Lars Ingebrigtsen
@ 2022-05-13 19:48 ` Lars Ingebrigtsen
2022-05-14 5:56 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-13 19:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I'll take a stab at doing that.
I've now done this, and used the new mode in csv-mode (if you're running
a new Emacs).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 19:48 ` Lars Ingebrigtsen
@ 2022-05-14 5:56 ` Eli Zaretskii
2022-05-14 11:28 ` Lars Ingebrigtsen
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-14 5:56 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 21:48:11 +0200
>
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
> > I'll take a stab at doing that.
>
> I've now done this, and used the new mode in csv-mode (if you're running
> a new Emacs).
So does this mean the original problem is now solved? Because at some
point you said that tabulated-list-mode didn't work correctly when
display-line-numbers-mode was toggled or something?
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-14 5:56 ` Eli Zaretskii
@ 2022-05-14 11:28 ` Lars Ingebrigtsen
2022-05-14 11:34 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-14 11:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: joostkremers, 55387
Eli Zaretskii <eliz@gnu.org> writes:
> So does this mean the original problem is now solved? Because at some
> point you said that tabulated-list-mode didn't work correctly when
> display-line-numbers-mode was toggled or something?
It didn't, but I fixed that bug.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-14 11:28 ` Lars Ingebrigtsen
@ 2022-05-14 11:34 ` Eli Zaretskii
0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-14 11:34 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Sat, 14 May 2022 13:28:43 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > So does this mean the original problem is now solved? Because at some
> > point you said that tabulated-list-mode didn't work correctly when
> > display-line-numbers-mode was toggled or something?
>
> It didn't, but I fixed that bug.
Thanks.
^ permalink raw reply [flat|nested] 19+ messages in thread
* bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed
2022-05-13 17:40 ` Lars Ingebrigtsen
2022-05-13 17:41 ` Lars Ingebrigtsen
@ 2022-05-14 5:17 ` Eli Zaretskii
1 sibling, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2022-05-14 5:17 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: joostkremers, 55387
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: joostkremers@fastmail.fm, 55387@debbugs.gnu.org
> Date: Fri, 13 May 2022 19:40:34 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> I know. We would introduce such a variable and (offer to) use it in
> >> header-line-mode.
> >
> > That's impossible, because the value depends on the buffer position.
>
> We only care about the value of the first (displayed) line after the
> header line, so the new variable would only be updated when we're
> computing that line. I.e., line 1.
Maybe in this particular mode, but it isn't always true.
And I don't really understand what will such a variable solve. If
some Lisp program can use a value of a variable, it can also call a
function and use its return value, no?
(In any case, we cannot provide a simple variable, because the value
depends on the window -- if the same buffer is displayed in several
windows, the value could be different in each one of those windows.)
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2022-05-14 11:34 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-12 15:33 bug#55387: 28.1.50; csv-mode: header does not align when line numbers are displayed Joost Kremers
2022-05-13 12:52 ` Lars Ingebrigtsen
2022-05-13 13:36 ` Eli Zaretskii
2022-05-13 13:41 ` Lars Ingebrigtsen
2022-05-13 14:12 ` Eli Zaretskii
2022-05-13 14:20 ` Eli Zaretskii
2022-05-13 15:55 ` Eli Zaretskii
2022-05-13 15:52 ` Lars Ingebrigtsen
2022-05-13 16:01 ` Eli Zaretskii
2022-05-13 16:04 ` Lars Ingebrigtsen
2022-05-13 17:09 ` Eli Zaretskii
2022-05-13 17:40 ` Lars Ingebrigtsen
2022-05-13 17:41 ` Lars Ingebrigtsen
2022-05-13 18:14 ` Lars Ingebrigtsen
2022-05-13 19:48 ` Lars Ingebrigtsen
2022-05-14 5:56 ` Eli Zaretskii
2022-05-14 11:28 ` Lars Ingebrigtsen
2022-05-14 11:34 ` Eli Zaretskii
2022-05-14 5:17 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.