[nXML-mode related]Q: How was modeline-process handled in XEmacs(was Re: Is there a working nxml-mode in XEmacs?)

It's me FKtPp ;) m_pupil at yahoo.com.cn
Sun Mar 9 06:14:12 EDT 2008


Stephen J. Turnbull wrote:
> It's me FKtPp ;) writes:
>
>  >   (setq modeline-process
>  >     `(rng-validate-mode ,(rng-compute-mode-line-string))))
>
> This code will evaluate `(rng-compute-mode-line-string)' at setq
> time.  What does that evaluate to?
>   
well it well be depends on the validation status of the buffer:

 string: " Valided xx%" if in progress;

 a list with first element is a extent: " Invalid"(with help-echo
messages and a keymap which can find the first invalid error point by
button1 click) if invalid;

 string: " Valid" if valid already.

here's the actual code:

(defconst rng-invalid-indicator
  (let* ((rng-modeline-process-string " Invalid")
     (rng-modeline-process-extent (make-extent 2 8
rng-modeline-process-string))
     (rng-modeline-process-map (make-keymap)))
    (define-key rng-modeline-process-map [(button1)] 'rng-mouse-first-error)
    (set-extent-properties rng-modeline-process-extent `(help-echo
"mouse-1: go to first error"
                             keymap ,rng-modeline-process-map))
    (list rng-modeline-process-extent rng-modeline-process-string))
  "Invalid modeline indicator for XEmacs nxml-mode")

(defun rng-compute-mode-line-string ()
  (cond (rng-validate-timer
     (concat " Validated:"
         (number-to-string
          ;; Use floor rather than round because we want
          ;; to show 99% rather than 100% for changes near
          ;; the end.
          (floor (if (eq (buffer-size) 0)
                 0.0
               (/ (* (- rng-validate-up-to-date-end 1) 100.0)
                  (buffer-size)))))
         "%%"))
    ((> rng-error-count 0)
;      (concat " "
;          (propertize "Invalid"
;                  'help-echo "mouse-1: go to first error"
;                  'local-map (make-mode-line-mouse-map
;                      'mouse-1
;                      'rng-mouse-first-error)))
     rng-invalid-indicator)
    (t " Valid")))




More information about the XEmacs-Beta mailing list