all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Unable to set 'display text property, but can set other props
@ 2020-09-11 17:35 Göktuğ Kayaalp
  2020-09-11 18:34 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Göktuğ Kayaalp @ 2020-09-11 17:35 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

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)))



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

end of thread, other threads:[~2020-09-11 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11 17:35 Unable to set 'display text property, but can set other props Göktuğ Kayaalp
2020-09-11 18:34 ` Eli Zaretskii
2020-09-11 21:01   ` Göktuğ Kayaalp

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.