From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Markers and text properties Date: Tue, 30 Aug 2011 22:19:40 +0200 Message-ID: <4E5D45DC.1040700@dogan.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1314735687 32400 80.91.229.12 (30 Aug 2011 20:21:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 30 Aug 2011 20:21:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 30 22:21:16 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QyUo7-0000s6-Od for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Aug 2011 22:21:15 +0200 Original-Received: from localhost ([::1]:41229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyUo6-0004rG-EH for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Aug 2011 16:21:14 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyUo0-0004qf-VQ for help-gnu-emacs@gnu.org; Tue, 30 Aug 2011 16:21:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QyUnz-0002hs-Sg for help-gnu-emacs@gnu.org; Tue, 30 Aug 2011 16:21:08 -0400 Original-Received: from ch-smtp04.sth.basefarm.net ([80.76.153.5]:41255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyUnz-0002hj-Gn for help-gnu-emacs@gnu.org; Tue, 30 Aug 2011 16:21:07 -0400 Original-Received: from c80-216-105-155.bredband.comhem.se ([80.216.105.155]:58309 helo=[192.168.0.10]) by ch-smtp04.sth.basefarm.net with esmtp (Exim 4.76) (envelope-from ) id 1QyUnJ-0005DP-Fq for help-gnu-emacs@gnu.org; Tue, 30 Aug 2011 22:20:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 X-Originating-IP: 80.216.105.155 X-Scan-Result: No virus found in message 1QyUnJ-0005DP-Fq. X-Scan-Signature: ch-smtp04.sth.basefarm.net 1QyUnJ-0005DP-Fq 0de7a9add552ef3782a912d5b19a99fd X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.76.153.5 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82095 Archived-At: Hi I'm writing yet another IRC client (named Nima) for Emacs. It is largely based on rcirc, for what it's worth. So for the input prompt in this client, I'm doing this: (define-derived-mode nima-mode nil "Nima" "Major mode for nima buffers." ;; Set up the input prompt. (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 ("> "). These are the values of nima-prompt-start and nima-prompt-end after some messages from the server: nima-prompt-start: # nima-prompt-end: # So basically the text I insert before the marker ends up invisible. In rcirc-print, we do something similar before the actual insertion takes place: ;; temporarily set the marker insertion-type because ;; insert-before-markers results in hidden text in new buffers (goto-char rcirc-prompt-start-marker) (set-marker-insertion-type rcirc-prompt-start-marker t) (set-marker-insertion-type rcirc-prompt-end-marker t) I don't understand this at all. What is going on? What should I do? Thanks, Deniz