[Top][All Lists]

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

equivalent to xemacs face-width?

From: Miguel Frasson
Subject: equivalent to xemacs face-width?
Date: 28 Oct 2003 16:12:36 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2


I am trying to port the package latex-symbols to gnu emacs, but I only
know the basics on lisp.

What is the GNU emacs equivalent to face-width? The code of a xemacs
function follows.



(defun ls-display-symbols (arg)
  "Pop up window showing all symbols of type ARG.
ARG may be one of
   'greek         to show greek letters
   'operators     to show binary operators
   'relations     to show binary relations
   'arrows        to show arrows
   'miscellany    to show everything else
   'other         to show other symbols
   'all           to show everything

   'plain         to show symbols defined in plain TeX/LaTeX
   'latexsym      to show symbols defined in latexsym.sty
   'amsfonts      to show symbols defined in amsfonts.sty
   'amsmath       to show symbols defined in amsmath.sty
   'amssymb       to show symbols defined in amssymb.sty
   'amsthm        to show symbols defined in amsthm.sty
   'stmaryrd      to show symbols defined in stmaryrd.sty"
  (let ((symbol-list
           (list (cons 'greek ls-greek)
                 (cons 'operators ls-ops)
                 (cons 'relations ls-rels)
                 (cons 'arrows ls-arrows)
                 (cons 'miscellany ls-misc)
                 (cons 'other ls-other)
                 (cons 'all ls-all)
                 (cons 'plain ls-plain)
                 (cons 'latexsym ls-latexsym)
                 (cons 'amsfonts ls-amsfonts)
                 (cons 'amsmath ls-amsmath)
                 (cons 'amssymb ls-amssymb)
                 (cons 'amsthm ls-amsthm)
                 (cons 'stmaryrd ls-stmaryrd)))))
        (bufname (concat " *(La)TeX symbols: " (symbol-name arg)))
        col1 col2 col3
        (default-width (face-width 'default))
        (spaces 5)
        (old-window (selected-window))
        (row 1) (column 1))
    (if symbol-list
          (with-output-to-temp-buffer bufname
            (setq third (/ (+ 2 (length symbol-list)) 3)
                  max-length (apply 'max (mapcar 'length symbol-list)))
            (while symbol-list
               ((= column 1)
                (setq col1 (cons (car symbol-list) col1)))
               ((= column 2)
                (setq col2 (cons (car symbol-list) col2)))
               ((= column 3)
                (setq col3 (cons (car symbol-list) col3))))
              (setq symbol-list (cdr symbol-list))
              (if (eq row third)
                  (setq row 1
                        column (1+ column))
                (setq row (1+ row))))
            (setq col1 (nreverse col1))
            (setq col2 (nreverse col2))
            (setq col3 (nreverse col3))
            (while (or col1 col2 col3)
              (setq glyph
                     (vector latex-symbol-picture-type
                              (concat "STRUT."
              (set-glyph-property glyph 'baseline 50)
                (set-buffer (get-buffer bufname))
                (setq extent (make-extent (point) (point))))
              (set-extent-begin-glyph extent glyph)
              (princ "     ")
              (if col1
                    (setq spaces
                          (- 5
                             (/ (ls-draw-sym (car col1) bufname)
                    (princ (make-string
                            (+ spaces
                               (- max-length (length (car col1))))
                            ?\ ))
                    (setq col1 (cdr col1))))
              (if col2
                    (setq spaces
                          (- 5
                             (/ (ls-draw-sym (car col2) bufname)
                    (princ (make-string
                            (+ spaces
                               (- max-length (length (car col2))))
                            ?\ ))
                    (setq col2 (cdr col2))))
              (if col3
                    (ls-draw-sym (car col3) bufname)
                    (setq col3 (cdr col3))))
            (select-window (get-buffer-window (get-buffer bufname)))
            (setq truncate-lines t)
            (select-window old-window)))
      (message "Unknown symbol type: %s" (symbol-name arg)))))

Miguel Vinicius Santini Frasson

reply via email to

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