all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21533: 24.5; current-column result varies between specified spaces using :width and :relative-width
@ 2015-09-22 14:29 Phil Sainty
  2015-09-22 16:57 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Sainty @ 2015-09-22 14:29 UTC (permalink / raw)
  To: 21533

I can't tell whether this is expected behaviour or not?

Starting from emacs -Q, in the *scratch* buffer, I get the following
results from evaluating these forms with C-j:

(progn (insert (propertize " " 'display '(space :width 2)))
        (current-column))
  2

(progn (insert (propertize " " 'display '(space :relative-width 2)))
        (current-column))
  1

Which is to say that a specified space of :width 2 occupies 2 columns,
while a specified space of :relative-width 2 occupies only 1 column.

This behaviour seems to be consistent, such that with :width the
current-column result comes from the (rounded) number of real columns
over which the specified space(s) stretch; whereas with :relative-width
the current-column is the same as it would have been without the text
property.

I'm confused because the manual doesn't seem to suggest that there
should be a difference between the two specifications, other than which
character is used as the basis for the visual appearance of the space:

(elisp) Specified Space:

‘:width WIDTH’
      If WIDTH is a number, it specifies that the space width should be
      WIDTH times the normal character width.  WIDTH can also be a "pixel
      width" specification (*note Pixel Specification::).

‘:relative-width FACTOR’
      Specifies that the width of the stretch should be computed from the
      first character in the group of consecutive characters that have
      the same ‘display’ property.  The space width is the width of that
      character, multiplied by FACTOR.


What I was hoping for was the control of being able to specify a precise
:width (because the resulting width of tabs when using :relative-width
gets rather tricky in practice when it comes to tabs which are not
tab-width wide), but with the (current-column) behaviour of
:relative-width.

(What I'm actually *doing* is scaling indentation, and so if the column
numbers vary with the scaling, then re-indenting the buffer causes
changes; and I want the effect to be purely visual.)


-Phil





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

end of thread, other threads:[~2015-09-23 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-22 14:29 bug#21533: 24.5; current-column result varies between specified spaces using :width and :relative-width Phil Sainty
2015-09-22 16:57 ` Eli Zaretskii
2015-09-23 12:32   ` Phil Sainty
2015-09-23 12:57     ` 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.