all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Markers and text properties
Date: Wed, 31 Aug 2011 01:58:34 -0400	[thread overview]
Message-ID: <E1Qydoo-0004by-Vb@fencepost.gnu.org> (raw)
In-Reply-To: <4E5D45DC.1040700@dogan.se> (message from Deniz Dogan on Tue, 30 Aug 2011 22:19:40 +0200)

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



  reply	other threads:[~2011-08-31  5:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 20:19 Markers and text properties Deniz Dogan
2011-08-31  5:58 ` Eli Zaretskii [this message]
2011-09-01  5:36   ` Deniz Dogan

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=E1Qydoo-0004by-Vb@fencepost.gnu.org \
    --to=eliz@gnu.org \
    --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.