all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* equivalent to xemacs face-width?
@ 2003-10-28 15:12 Miguel Frasson
  2003-10-28 17:07 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Miguel Frasson @ 2003-10-28 15:12 UTC (permalink / raw)



Hi

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.

Thanks.

Miguel.

(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
	 (cdr
	  (assoc
	   arg
	   (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
	third
	max-length
	(default-width (face-width 'default))
	(spaces 5)
	(old-window (selected-window))
	glyph
	extent
	(row 1) (column 1))
    (if symbol-list
	(progn
	  (with-output-to-temp-buffer bufname
	    (setq third (/ (+ 2 (length symbol-list)) 3)
		  max-length (apply 'max (mapcar 'length symbol-list)))
	    (while symbol-list
	      (cond
	       ((= 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
		    (make-glyph
		     (vector latex-symbol-picture-type
			     :file
			     (expand-file-name
			      (concat "STRUT."
				      (ls-picture-type-name))
			      (expand-file-name
			       (ls-picture-type-name)
			       latex-symbol-directory)))))
	      (set-glyph-property glyph 'baseline 50)
	      (save-excursion
		(set-buffer (get-buffer bufname))
		(setq extent (make-extent (point) (point))))
	      (set-extent-begin-glyph extent glyph)
	      (princ "     ")
	      (if col1
		  (progn
		    (setq spaces
			  (- 5
			     (/ (ls-draw-sym (car col1) bufname)
				default-width)))
		    (princ (make-string
			    (+ spaces
			       (- max-length (length (car col1))))
			    ?\ ))
		    (setq col1 (cdr col1))))
	      (if col2
		  (progn
		    (setq spaces
			  (- 5
			     (/ (ls-draw-sym (car col2) bufname)
				default-width)))
		    (princ (make-string
			    (+ spaces
			       (- max-length (length (car col2))))
			    ?\ ))
		    (setq col2 (cdr col2))))
	      (if col3
		  (progn
		    (ls-draw-sym (car col3) bufname)
		    (setq col3 (cdr col3))))
	      (terpri)))
	  (save-excursion
	    (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
http://www.math.leidenuniv.nl/~frasson

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: equivalent to xemacs face-width?
  2003-10-28 15:12 equivalent to xemacs face-width? Miguel Frasson
@ 2003-10-28 17:07 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2003-10-28 17:07 UTC (permalink / raw)


Miguel Frasson wrote:

> 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.
...


> 	(default-width (face-width 'default))


Just a guess:
(face-attribute 'default :width)

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-28 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-28 15:12 equivalent to xemacs face-width? Miguel Frasson
2003-10-28 17:07 ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.