unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: 28771@debbugs.gnu.org
Subject: bug#28771: 26.0.60; A couple space display property feature requests
Date: Mon, 09 Oct 2017 20:02:23 -0600	[thread overview]
Message-ID: <87bmlfbw0g.fsf@gmail.com> (raw)
In-Reply-To: <87fuarc0px.fsf@gmail.com> (Alex's message of "Mon, 09 Oct 2017 18:20:42 -0600")

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

Alex <agrambot@gmail.com> writes:

> 1. Specifying the pixel width to the left/center/right of the text area.
>    This is helpful (I believe it's necessary if I want it to be robust)
>    when one wants to pad either side of a string with the same number of
>    pixels and the left side uses (:align-to 0).
>
>    I could use (:width (+ left-fringe left-margin)) for the right
>    padding, but this doesn't take into account line-number display, as
>    well as the scroll-bar width (if it's on the left).
>
> 2. Specifying the pixel position relative to the left or right edge of
>    the window. The right edge of the window currently may be the right
>    edge of the right fringe or the scroll bar, depending on what side it
>    is on. Also, just in the case that in the future the
>    fringe/scroll-bar may not be the outermost elements, there should be
>    a way to explicitly specify one of the edges.

Here's a diff that implements both #1 and #2:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: space --]
[-- Type: text/x-diff, Size: 1587 bytes --]

diff --git a/src/xdisp.c b/src/xdisp.c
index b14b7daf2b..d5fa3a1cfe 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25210,6 +25210,10 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
 				   + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
 				      ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
 				      : 0)));
+          if (EQ (prop, Qleft_edge))
+            return OK_ALIGN_TO (WINDOW_LEFT_PIXEL_EDGE (it->w));
+          if (EQ (prop, Qright_edge))
+            return OK_ALIGN_TO (WINDOW_RIGHT_PIXEL_EDGE (it->w));
 	}
       else
 	{
@@ -25223,6 +25227,13 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
 	    return OK_PIXELS (WINDOW_RIGHT_MARGIN_WIDTH (it->w));
 	  if (EQ (prop, Qscroll_bar))
 	    return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
+	  if (EQ (prop, Qleft))
+            return OK_PIXELS (window_box_left_offset (it->w, TEXT_AREA));
+          if (EQ (prop, Qright))
+	    return OK_PIXELS (window_box_right_offset (it->w, TEXT_AREA));
+	  if (EQ (prop, Qcenter))
+	    return OK_PIXELS (window_box_left_offset (it->w, TEXT_AREA)
+				+ window_box_width (it->w, TEXT_AREA) / 2);
 	}
 
       prop = buffer_local_value (prop, it->w->contents);
@@ -32207,6 +32218,8 @@ They are still logged to the *Messages* buffer.  */);
   DEFSYM (Qspace, "space");
   DEFSYM (Qmargin, "margin");
   DEFSYM (Qpointer, "pointer");
+  DEFSYM (Qleft_edge, "left-edge");
+  DEFSYM (Qright_edge, "right-edge");
   DEFSYM (Qleft_margin, "left-margin");
   DEFSYM (Qright_margin, "right-margin");
   DEFSYM (Qcenter, "center");

  reply	other threads:[~2017-10-10  2:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10  0:20 bug#28771: 26.0.60; A couple space display property feature requests Alex
2017-10-10  2:02 ` Alex [this message]
2017-10-10  6:47 ` Eli Zaretskii
2017-10-10 17:54   ` Alex
2017-10-10 19:12     ` Eli Zaretskii
2017-10-10 21:27       ` Alex
2017-10-11 12:59         ` Eli Zaretskii
2017-10-11 15:37           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmlfbw0g.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=28771@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).