Mercurial > hgrepos > hgweb.cgi > yatex
diff yatexhlp.el @ 366:77a2fd4fd634
merged
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 26 Dec 2014 01:06:32 +0900 |
parents | d69fd7b1ac4d |
children | e009c4f86ede |
line wrap: on
line diff
--- a/yatexhlp.el Mon Apr 01 23:03:34 2013 +0900 +++ b/yatexhlp.el Fri Dec 26 01:06:32 2014 +0900 @@ -1,7 +1,7 @@ ;;; yatexhlp.el --- YaTeX helper with LaTeX commands and macros ;;; -;;; (c)1994,1998,2004 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sat Sep 1 08:11:14 2012 on firestorm +;;; (c)1994,1998,2004,2014 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sun Dec 21 22:55:07 2014 on firestorm ;;; $Id$ ;;; Code: @@ -45,8 +45,8 @@ (setq YaTeX-help-mode-map (make-sparse-keymap)) (let ((map YaTeX-help-mode-map)) (suppress-keymap map) - (define-key map "j" '(lambda () (interactive) (scroll-up 1))) - (define-key map "k" '(lambda () (interactive) (scroll-up -1))) + (define-key map "j" (function (lambda () (interactive) (scroll-up 1)))) + (define-key map "k" (function (lambda () (interactive) (scroll-up -1)))) (define-key map "n" 'next-line) (define-key map "p" 'previous-line) (define-key map " " 'scroll-up) @@ -159,7 +159,7 @@ (concat "^" (regexp-quote YaTeX-help-delimiter)) nil 1) (- (point) (length YaTeX-help-delimiter)))) (YaTeX-showup-buffer - hbuf (function (lambda (x) (nth 3 (window-edges x)))) t) + hbuf 'YaTeX-showup-buffer-bottom-most t) (set-buffer hbuf) (setq buffer-read-only nil) (if append (goto-char (point-max)) (erase-buffer)) @@ -226,7 +226,7 @@ (let ((buf (get-buffer-create "**Description**")) (conf (current-window-configuration))) (YaTeX-showup-buffer - buf (function (lambda (x) (nth 3 (window-edges x)))) t) + buf 'YaTeX-showup-buffer-bottom-most t) (make-local-variable 'YaTeX-help-file-current) (make-local-variable 'YaTeX-help-command-current) (make-local-variable 'YaTeX-help-saved-config) @@ -266,8 +266,7 @@ (sw (selected-window)) (head (concat "^" (regexp-quote YaTeX-help-delimiter))) pt command) - (YaTeX-showup-buffer - ab (function (lambda (x) (nth 3 (window-edges x))))) + (YaTeX-showup-buffer ab 'YaTeX-showup-buffer-bottom-most) (select-window (get-buffer-window ab)) (set-buffer ab) ;assertion (setq buffer-read-only nil) @@ -302,8 +301,9 @@ (message "No matches found."))) ;;;###autoload -(defun YaTeX-help () - "Show help buffer of LaTeX/TeX commands or macros." +(defun YaTeX-help (&optional macro) + "Show help buffer of LaTeX/TeX commands or macros. +Optional argument MACRO, if supplied, is directly selected to keyword." (interactive) (let (p beg end command) (save-excursion @@ -311,6 +311,7 @@ (goto-char (match-end 0))) (setq p (point)) ;remember current position. (cond + (macro nil) ((YaTeX-on-begin-end-p) ;;if on \begin or \end, extract its environment. (setq command @@ -331,10 +332,11 @@ (search-forward "}" (point-end-of-line)) (setq command (buffer-substring beg (match-beginning 0))))) (setq command - (completing-read - "Describe (La)TeX command: " - YaTeX-help-entries nil nil command)) - );end excursion + (or macro + (completing-read + "Describe (La)TeX command: " + YaTeX-help-entries nil nil command))));end excursion + (setq YaTeX-help-saved-config (current-window-configuration)) (or (YaTeX-refer-help command YaTeX-help-file) (YaTeX-refer-help command YaTeX-help-file-private)