help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: efficiently viewing Unix timestamps as dates


From: Ted Zlatanov
Subject: Re: efficiently viewing Unix timestamps as dates
Date: Tue, 24 May 2011 20:01:06 -0000
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

On Tue, 19 Apr 2011 12:23:45 -0300 Stefan Monnier <monnier@iro.umontreal.ca> 
wrote: 

>> I don't understand why it should remove the display property
>> conditionally.  I want my package (epoch-view.el) to supercede any other
>> display properties for text that matches the epoch timestamp regular
>> expression, or it won't work properly (some text will not have the
>> display property I want it to have).  You can argue that the other
>> packages' display property may be important, but I think mine is
>> important too.

SM> The issue is to not remove the display property placed on *other*
SM> chunks of text.

The package only applies the display property to text it matches.  Where
is the display property removed through the font-lock mechanism by my
package?  Here are the keywords in question (`epoch-view-render' applies
the display property).

(defvar epoch-view-font-lock-keywords
  '(("\\<[0-9]\\{8,11\\}\\>"
     (0 (epoch-view-render))))
  "Font-lock keywords of epoch timestamps.")

(defun epoch-view-render ()
  "Render a epoch match."
  (let ((text (match-string-no-properties 0)))
    `(face font-lock-warning-face
           display ,(epoch-view--render text))))

(defun epoch-view-turn-on ()
  "Turn on epoch-view-mode."
  (let ((props (make-local-variable 'font-lock-extra-managed-props)))
    (add-to-list props 'display))

  (font-lock-add-keywords nil epoch-view-font-lock-keywords))

Sorry if I seem dense but I really don't get what's causing this
problem.  It would be helpful if you could tell me what mode, combined
with `epoch-view-mode', will exhibit the problem.

Thanks
Ted


reply via email to

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