[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unable to set 'display text property, but can set other props

From: Göktuğ Kayaalp
Subject: Unable to set 'display text property, but can set other props
Date: Fri, 11 Sep 2020 20:35:40 +0300
User-agent: mu4e 1.2.0; emacs 28.0.50

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)
    (get-buffer-window (current-buffer)))))

(with-current-buffer ""
    (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)))
            (search-forward (plist-get headline :raw-value)
            (search-forward ":" (line-end-position))))
       headline-end-position (1+ headline-end-position)
           (- (window-pixel-width)
              ;; width of tags:
              (- (car (---getposnxy (1+ headline-end-position)))
                 (car (---getposnxy (line-end-position)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]