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

[xyzzy:04087] Re: which-function mode



冨永さん、こんにちは。

    Thu, 3 Feb 2000 15:32:43 +0900 の
   “[xyzzy:04085] which-function mode”
    への返事です.

| と思うのですが、xyzzyで同じ様な事をやるのは
| 難しいのでしょうか?

めっさてけとーなのでよければこんな感じでできます。これ
だとモードの解除もできないし、関数名の探し方もいいかげ
んなので、実用にはならないと思いますが。誰か気合のある
人がちゃんとしたのを書いてくれるかも…。


(or (boundp 'which-function-mode)
    (setq which-function-mode nil))
(or (boundp 'which-function-mode-name)
    (setq which-function-mode-name nil))
(or (boundp 'which-function-mode-last-point)
    (setq which-function-mode-last-point nil))

(defun which-function-find-defun ()
  (save-excursion
    (forward-char 1)
    (beginning-of-defun)
    (unless (eql which-function-mode-last-point (point))
      (setq which-function-mode-last-point (point))
      (forward-line -1)
      (setq which-function-mode-name
	    (buffer-substring (point) (progn (goto-eol) (point))))
      (update-mode-line))))

(defun which-function-mode ()
  (interactive)
  (make-local-variable 'which-function-mode)
  (setq which-function-mode t)
  (make-local-variable 'which-function-mode-name)
  (make-local-variable 'which-function-mode-last-point)
  (make-local-variable '*post-command-hook*)
  (add-hook '*post-command-hook* 'which-function-find-defun))

(pushnew '(which-function-mode . which-function-mode-name)
	 *minor-mode-alist* :key #'car)


--
亀井哲弥(Tetsuya Kamei)
kamei@xxxxxxxxxxxx/JCA00343@xxxxxxxxxxx

Index Home