all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Göktuğ Kayaalp" <self@gkayaalp.com>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Unable to set 'display text property, but can set other props
Date: Fri, 11 Sep 2020 20:35:40 +0300	[thread overview]
Message-ID: <87sgbotdw3.fsf@gkayaalp.com> (raw)

Please observe the snippet at the end of the message.

What I’m trying to do is to expand one space character enough to align
the text following the character on the same line to the right edge of
the window.

Problem is, while I can set properties like 'help-echo on the region, I
can’t set 'display.  I’ve tried variations of the below with `(space
. (:width ...)) too.

Maths is probably somewhat off, but the actual problem is that I can’t
set any 'display props, e.g. ‘STRING’ too.

I’ve tried just using things akin to

(put-text-property 67 68 'display '(space-width 10))

using M-:.

Why is this happening? Am I doing something very obviously wrong?  Or
is it something else?


(defun ---getposnxy (point)
  (posn-x-y
   (posn-at-point
    point
    (get-buffer-window (current-buffer)))))

(with-current-buffer "Todo.org"
  (save-excursion
    (goto-char (point-min))
    (org-next-visible-heading 1)
    (goto-char (line-beginning-position))
    (let* ((case-fold-search nil)
           (elem-at-point (org-element-at-point))
           (headline (progn (unless (eq 'headline (car elem-at-point))
                              (error "Element at point is not a headline"))
                            (cadr elem-at-point)))
           (headline-end-position
            (search-forward (plist-get headline :raw-value)
                            (line-end-position)))
           (point-at-tags-beginning
            (search-forward ":" (line-end-position))))
      (put-text-property
       headline-end-position (1+ headline-end-position)
       'display
       `(space-wdith
         ,(/
           (- (window-pixel-width)
              ;; width of tags:
              (- (car (---getposnxy (1+ headline-end-position)))
                 (car (---getposnxy (line-end-position)))))
           (frame-char-width)))
       (current-buffer))
      headline-end-position)))



             reply	other threads:[~2020-09-11 17:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 17:35 Göktuğ Kayaalp [this message]
2020-09-11 18:34 ` Unable to set 'display text property, but can set other props Eli Zaretskii
2020-09-11 21:01   ` Göktuğ Kayaalp

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

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

  git send-email \
    --in-reply-to=87sgbotdw3.fsf@gkayaalp.com \
    --to=self@gkayaalp.com \
    --cc=help-gnu-emacs@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 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.