[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Markers and text properties
From: |
Eli Zaretskii |
Subject: |
Re: Markers and text properties |
Date: |
Wed, 31 Aug 2011 01:58:34 -0400 |
> Date: Tue, 30 Aug 2011 22:19:40 +0200
> From: Deniz Dogan <deniz@dogan.se>
>
> (set (make-local-variable 'nima-prompt-start) (point-max-marker))
> (set (make-local-variable 'nima-prompt-end) (point-max-marker))
> (let ((prompt
> (propertize "> "
> 'face 'nima-prompt-face
> 'read-only t
> 'intangible t
> 'field t
> 'front-sticky t
> 'rear-nonsticky t)))
> (insert prompt)
> (set-marker nima-prompt-start (- (point) (length prompt)))
> (set-marker nima-prompt-end (point))
> (set-marker-insertion-type nima-prompt-start t)
> (set-marker-insertion-type nima-prompt-end t)))
>
> And when I want to insert something into a Nima buffer I do this
> (slightly simplified):
>
> (defun nima-print (buffer prefix rest)
> (with-current-buffer buffer
> (let ((old-point (point-marker))
> (inhibit-read-only t)
> (time-string (format-time-string nima-time-format)))
> (insert-before-markers time-string)
> (insert-before-markers prefix rest "\n"))
> (goto-char old-point)))
>
> The problem is that the only thing that ends up being _visible_ is the
> input prompt ("> ").
> [...]
> I don't understand this at all. What is going on? What should I do?
Sorry, I can't make heads or tails out of your description. Perhaps I
don't yet have enough caffeine in my blood ;-) And since you didn't
show a complete example, I cannot try anything myself.
First, where does the invisibility come from? I see no invisible
properties in the fragments you posted, only intangible (which AFAIK
does not hide text). Are you saying that Emacs hides text without any
reason such as text properties?
Next, I don't understand all the games you play with stickyness,
insertions, and markers. For starters:
. you define stickyness properties, but use insert and
insert-before-markers which are documented to not inherit text
properties, so stickyness is not relevant to the code you wrote
. you use set-marker-insertion-type, but insert-before-markers is
documented to ignore the markers' insertion types
What is going on? What am I missing here?