emacs 18 functions

Yuuichi Teranishi teranisi @ gohome.org
2000年 1月 28日 (金) 16:47:37 JST


v18 が話題になっているついでに、
個人的に poe-18.el に取りこめるといいなと思っている関数を
以下にあげてみます。
御意見などいただけると幸いです。
;; 他にもまだあるけど...。

-------------- next part --------------
(or (fboundp 'si:completing-read)
    (progn
      (fset 'si:completing-read (symbol-function 'completing-read))
      (defun completing-read
	(prompt table &optional predicate require-match initial-input
	 hist def inherit-input-method)
	"Read a string in the minibuffer, with completion.
PROMPT is a string to prompt with; normally it ends in a colon and a space.
TABLE is an alist whose elements' cars are strings, or an obarray.
PREDICATE limits completion to a subset of TABLE.
See `try-completion' and `all-completions' for more details
 on completion, TABLE, and PREDICATE.

If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
 the input is (or completes to) an element of TABLE or is null.
 If it is also not t, Return does not exit if it does non-null completion.
If the input is null, `completing-read' returns an empty string,
 regardless of the value of REQUIRE-MATCH.

If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
  If it is (STRING . POSITION), the initial input
  is STRING, but point is placed POSITION characters into the string.
HIST is ignored in this implementation.
DEF, if non-nil, is the default value.
INHERIT-INPUT-METHOD is ignored in this implementation.

Completion ignores case if the ambient value of
  `completion-ignore-case' is non-nil."
	(let ((string (si:completing-read prompt table predicate
					  require-match initial-input)))
	  (if (eq (length string) 0) def string)))))

(or (fboundp 'si:get-buffer-window)
    (progn
      (fset 'si:get-buffer-window (symbol-function 'get-buffer-window))
      (defun get-buffer-window (buffer &rest args)
	"Return a window currently displaying BUFFER, or nil if none.
Arguments other than BUFFER are ignored in this implementation."
	(si:get-buffer-window buffer))))

(or (fboundp 'si:accept-process-output)
    (progn
      (fset 'si:accept-process-output (symbol-function 'accept-process-output))
      (defun accept-process-output (&optional process timeout timeout-msecs)
	"Allow any pending output from subprocesses to be read by Emacs.
It is read into the process' buffers or given to their filter functions.
Non-nil arg PROCESS means do not return until some output has been received
 from PROCESS. Nil arg PROCESS means do not return until some output has
 been received from any process.
TIMEOUT and TIMEOUT-MSECS are ignored in this implementation."
	(si:accept-process-output process))))

(defun window-live-p (obj)
  "Returns t if OBJECT is a window which is currently visible."
  (and (windowp obj)
       (or (eq obj (minibuffer-window))
	   (eq obj (get-buffer-window (window-buffer obj))))))
-------------- next part --------------
--
Yuuichi Teranishi (寺西裕一) <teranisi @ isl.ntt.co.jp>
NTT Cyber Space Laboratories Information-base Project
"The love you take is equal to the love you make..."


More information about the APEL-ja mailing list