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

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

help on text-properties


From: Yu,Gang
Subject: help on text-properties
Date: Wed, 6 Jun 2007 13:15:35 +0800

Hi all:
  I want to set text properties on a string, however, any time I get a nil result after the (set|add)-text-properties call, the text is not properly propetied.

 what's wrong??

I use emacs 22.1, here is the source code:

(defun show-paren-minibuffer (pair-point pos)
  "show the paren pair in the minibuffer, pos is current point , pair-point is the point of the paren pair"
  (if (not (pos-visible-in-window-p pair-point))
      (let ((pair-line-number (line-number-at-pos pair-point))
        (pos-line-number (line-number-at-pos pos))
        show-string
        offset)
    (if (not (equal pair-line-number pos-line-number))
        (save-excursion
          (goto-line pair-line-number)
          (setq offset (- pair-point (line-beginning-position)))
          (setq show-string (buffer-substring (line-beginning-position) (line-end-position)))
          (diag-pr (set-text-properties offset offset '(comment t face highlight) show-string))
          (if (< (length show-string) 20)
          (setq show-string
            (concat
             (buffer-substring
              (- (line-beginning-position) 30) 
              (- (line-beginning-position) 1))
             "\n"
             show-string
             "\n"
             (buffer-substring
              (+ (line-end-position) 1)
              (+ (line-end-position) 30)))))
          (message "%s" show-string))))))

and my diag-pr macro:

(defmacro diag-pr (exp)
  "print the _expression_ result in the *scratch buffer"
  `(let ((tmp-diag-var ,exp))
     (print (list ',exp 'result 'is (list tmp-diag-var)) diag-buffer)
     tmp-diag-var))

in the diag-buffer, all resutls display "nil"

How can I sovle the problem?

thanks !!

--
YuGang
reply via email to

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