Subject: 29.0.50; Wish: Extend `:align-to center' to work on lines in buffer

From: Arthur Miller <[email-masked]>
Date: Fri, 26 Nov 2021 21:01:11 +0100

I am not sure if the title is descriptive enough, or even correct, but as seen
from attached code and image, I am trying to align two strings in a center of
each strings line.

It works now when string-pixel-width correctly calculates pixel widths. However,
I would prefer if I could just use :align-to center as a spec for a string as
property. Currently we have to use space as a spacer as we used to use
gif-spacers back in time.

I am not sure about how semantics would work, there are several cases to
consider, but generally if a string or a stretch of text in a string were given
text property 'display '(:align-to center), then Emacs would align that stretch
of text in the middle of the line that text occupies.

There would be cases where text dooes not fit the line, where there are multiple
such substring in same line maybe etc.

I don't know if it is possible or not, I am not familar with the display code,
nor am I sure about the syntax of proposal, but it would be nice and probably
useful to have some more declarative approach then what I had to do procedurally
in the attached example.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-11-26 built on pascal
Repository revision: c32e8bdc23214793ffcb065ba8478570679c1f0a
Repository branch: alpha-patch
Windowing system distributor 'The X.Org Foundation', version 11.0.12101001
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation 'CFLAGS=-O2 -mtune=native -march=native''

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

Important settings:
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  windmove-mode: t
  beacon-mode: t
  outshine-mode: t
  dired-async-mode: t
  outline-minor-mode: t
  yas-minor-mode: t
  page-break-lines-mode: t
  company-mode: t
  electric-pair-mode: t
  global-auto-revert-mode: t
  global-hl-line-mode: t
  global-subword-mode: t
  subword-mode: t
  auto-image-file-mode: t
  auto-insert-mode: t
  display-time-mode: t
  delete-selection-mode: t
  save-place-mode: t
  winner-mode: t
  which-key-mode: t
  wrap-region-global-mode: t
  wrap-region-mode: t
  helm-mode: t
  helm-adaptive-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: t
  helm--remap-mouse-mode: t
  async-bytecomp-package-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: yas--auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
/home/arthur/repos/emacs/lisp/transient hides /home/arthur/.emacs.d/elpa/transient-20210723.1601/transient
/home/arthur/.emacs.d/elpa/lispy-20210914.1209/elpa hides /home/arthur/.emacs.d/elpa/ivy-20210930.1450/elpa
/home/arthur/repos/emacs/lisp/emacs-lisp/helper hides /home/arthur/.emacs.d/elpa/helper-0.5/helper
/home/arthur/.emacs.d/lisp/helm-git-branch hides /home/arthur/.emacs.d/elpa/helm-git-branch-0.1/helm-git-branch
/usr/local/share/emacs/site-lisp/emms/emms-cue hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-cue
/usr/local/share/emacs/site-lisp/emms/emms-info-ogginfo hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-ogginfo
/usr/local/share/emacs/site-lisp/emms/emms-mark hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-mark
/usr/local/share/emacs/site-lisp/emms/emms-last-played hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-last-played
/usr/local/share/emacs/site-lisp/emms/emms-player-mpg321-remote hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mpg321-remote
/usr/local/share/emacs/site-lisp/emms/emms-score hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-score
/usr/local/share/emacs/site-lisp/emms/emms-player-mpd hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mpd
/usr/local/share/emacs/site-lisp/emms/emms-show-all hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-show-all
/usr/local/share/emacs/site-lisp/emms/emms-setup hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-setup
/usr/local/share/emacs/site-lisp/emms/emms-playlist-sort hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playlist-sort
/usr/local/share/emacs/site-lisp/emms/emms hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms
/usr/local/share/emacs/site-lisp/emms/emms-info-mp3info hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-mp3info
/usr/local/share/emacs/site-lisp/emms/emms-source-playlist hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-source-playlist
/usr/local/share/emacs/site-lisp/emms/emms-cache hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-cache
/usr/local/share/emacs/site-lisp/emms/emms-volume hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-volume
/usr/local/share/emacs/site-lisp/emms/emms-playing-time hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playing-time
/usr/local/share/emacs/site-lisp/emms/emms-tag-editor hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-tag-editor
/usr/local/share/emacs/site-lisp/emms/emms-source-file hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-source-file
/usr/local/share/emacs/site-lisp/emms/emms-bookmarks hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-bookmarks
/usr/local/share/emacs/site-lisp/emms/emms-player-simple hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-simple
/usr/local/share/emacs/site-lisp/emms/emms-player-xine hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-xine
/usr/local/share/emacs/site-lisp/emms/emms-librefm-stream hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-librefm-stream
/usr/local/share/emacs/site-lisp/emms/emms-browser hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-browser
/usr/local/share/emacs/site-lisp/emms/emms-maint hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-maint
/usr/local/share/emacs/site-lisp/emms/emms-playlist-mode hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playlist-mode
/usr/local/share/emacs/site-lisp/emms/emms-url hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-url
/usr/local/share/emacs/site-lisp/emms/emms-streams hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-streams
/usr/local/share/emacs/site-lisp/emms/emms-info-opusinfo hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-opusinfo
/usr/local/share/emacs/site-lisp/emms/emms-mode-line hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-mode-line
/usr/local/share/emacs/site-lisp/emms/emms-player-mplayer hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mplayer
/usr/local/share/emacs/site-lisp/emms/emms-info hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info
/usr/local/share/emacs/site-lisp/emms/emms-librefm-scrobbler hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-librefm-scrobbler
/usr/local/share/emacs/site-lisp/emms/emms-info-libtag hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-libtag
/usr/local/share/emacs/site-lisp/emms/emms-info-metaflac hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-metaflac
/usr/local/share/emacs/site-lisp/emms/emms-metaplaylist-mode hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-metaplaylist-mode
/usr/local/share/emacs/site-lisp/emms/emms-compat hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-compat
/usr/local/share/emacs/site-lisp/emms/emms-volume-pulse hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-volume-pulse
/usr/local/share/emacs/site-lisp/emms/emms-player-mpv hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mpv
/usr/local/share/emacs/site-lisp/emms/emms-playlist-limit hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playlist-limit
/usr/local/share/emacs/site-lisp/emms/emms-history hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-history
/usr/local/share/emacs/site-lisp/emms/emms-player-vlc hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-vlc
/usr/local/share/emacs/site-lisp/emms/emms-mode-line-icon hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-mode-line-icon
/usr/local/share/emacs/site-lisp/emms/emms-lyrics hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-lyrics
/usr/local/share/emacs/site-lisp/emms/emms-stream-info hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-stream-info
/usr/local/share/emacs/site-lisp/emms/emms-volume-amixer hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-volume-amixer
/usr/local/share/emacs/site-lisp/emms/emms-i18n hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-i18n
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs-autoloads hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs-autoloads
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs-pkg hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs-pkg
/home/arthur/.emacs.d/lisp/company-cmake hides /home/arthur/.emacs.d/elpa/company-20211002.1732/company-cmake

Features:
(shadow emacsbug sendmail mm-archive misearch multi-isearch gnus-fun smiley
mail-extr qp gnus-async gnus-ml gnus-topic cursor-sensor url-cache benchmark
nndraft nnmh nnhackernews anaphora request gnus-bcklg gnus-cite nnfolder utf-7
gnutls network-stream gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg nntp gnus-cache help-fns radix-tree cl-print debug helm-command
emacs-vision-clock windmove time-stamp vc-git diff-mode vc-dispatcher
org-pretty-table ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe gnus-art mm-uu
mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group
gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 netrc
nnoo gnus-spec gnus-int gnus-range message yank-media rfc822 mml mml-sec epa epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
gnus-win ol-docview doc-view ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi
dired-auto-readme helm-external helm-net tramp-archive tramp-gvfs tramp-cache
zeroconf dbus ffap beacon emms-librefm-stream xml emms-librefm-scrobbler
emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode
emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort
emms-last-played emms-player-xine emms-player-mpd emms-lyrics emms-url
emms-streams emms-show-all emms-tag-editor emms-mark emms-cache
emms-info-opusinfo emms-info-ogginfo emms-info-mp3info emms-player-vlc
emms-player-mplayer emms-player-mpv emms-mode-line-cycle emms-mode-line
emms-playing-time emms-player-simple emms-info later-do emms-playlist-limit
emms-volume emms-volume-amixer emms-playlist-mode emms-source-playlist
emms-source-file locate emms-setup emms emms-compat c++-setup sv-kalender lunar
solar cal-dst holidays hol-loaddefs extras recentf tree-widget server overseer
pkg-info url-http url-auth url-gw nsm rmc puny epl f s outshine
outshine-org-cmds outorg org-protocol org-pdftools pdf-occur pdf-isearch
let-alist pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw mode-local cedet facemenu pdf-misc imenu pdf-tools
cus-edit cus-start cus-load pdf-view bookmark pp jka-compr pdf-cache pdf-info tq
pdf-util pdf-macs image-mode dired-extras dired-copy-paste dired-subtree
dired-hacks-utils openwith dired-x wdired dired-async dired-aux dired
dired-loaddefs exif org-noter org-element avl-tree org-refile 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 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 noutline outline yasnippet-snippets
yasnippet derived disp-table page-break-lines company-yasnippet company-ispell
ispell company-clang company-elisp company-etags etags fileloop generator xref
project company-semantic company-template company-keywords company-files
company-capf company pcase elec-pair autorevert hl-line cap-words superword
subword image-file image-converter autoinsert time delsel saveplace winner
which-key advice solarized-dark-theme solarized solarized-faces color
wrap-region dash gnus nnheader gnus-util rmail rmail-loaddefs mail-utils
wid-edit helm-mode helm-adaptive helm-projectile projectile lisp-mnt mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr grep compile
text-property-search ibuf-ext ibuffer ibuffer-loaddefs thingatpt helm-eshell
helm-elisp helm-files filenotify tramp tramp-loaddefs trampver tramp-integration
files-x tramp-compat shell pcomplete comint ansi-color parse-time iso8601
time-date ls-lisp helm-buffers helm-occur helm-tags helm-locate helm-eval edebug
backtrace find-func helm-info ring helm-types helm-config diminish helm-pages
helm-grep helm-regexp helm-utils helm-help format-spec helm easy-mmode
async-bytecomp helm-global-bindings edmacro kmacro helm-source helm-multi-match
helm-lib async elisp-extras popup comp comp-cstr warnings rx cl-extra help-mode
helm-easymenu cl 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 map url-vars seq gv subr-x byte-opt 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 keymap 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 730568 792838)
 (symbols 48 46135 895)
 (strings 32 166920 139329)
 (string-bytes 1 6499549)
 (vectors 16 97681)
 (vector-slots 8 1997619 1820891)
 (floats 8 1412 6559)
 (intervals 56 4846 6212)
 (buffers 992 47))