[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: arglist display
- To: firstname.lastname@example.org
- Subject: Re: arglist display
- From: email@example.com
- Date: Fri, 15 Jan 93 18:20:09 -0800
- Comments: Spell "cambridge" right this time.
- Reply-to: firstname.lastname@example.org
Date: 15 Jan 93 18:15:46 GMT
(setq ccl::*save-arglist-info* t)
However, what it still doesn't do, is if you type (foo , and foo is not a
function is erase the old arglist.
Basically, if I'm looking for a function name that I'm not sure of and I
just used another function with a similar arglist, I have to type (let and
then erase that just to get a known arglist so I can see if it changes when
I type (foo to see if foo *really* has an arglist, or I'm just seeing the
arglist from before.
Here's something that I find works pretty well. It searches backwards
for the current function and displays its arglist. As is my custom,
I've left it unfinished. See the bugs list.
;;; Improved Arglist (c-x c-a)
;;; - ed-arglist will display the arglist for FOO:BAR even if BAR isn't exported
;;; from FOO. This is confusing. ed-improved-arglist gets a reader error in
;;; this case. Since only a simple-error is signalled I'm not going to bother
;;; to handle it. Hopefully in MCL 2.0 final a more specific condition will be
;;; - ed-improved-arglist can be fooled if the cursor is in a string. Once
;;; again we need to have some concept of the current syntactic context...
;;; - Blows chow on '(#\c
;;; - ARGLIST returns NIL for some forms like LET, (SETF C*R), etc but
;;; ed-arglist finds the arglist somehow. Need to figure out how it works.
;;; to do:
;;; - Find local function arglists a la FLET, LABELS and MACROLET.
;;; This could be an option since it will be slow
;;; - Figure out how wide the minibuffer display is so I can determine whether
;;; the function name should be abbreviated (or left off entirely, if it isn't
(defparameter *arglist-show-function-name* nil)
(defun display-arglist (symbol window)
;;(set-mini-buffer window "~%") ; clear the mini-buffer
(multiple-value-bind (arglist arglist-type)
(arglist symbol t)
(if (null arglist-type)
(set-mini-buffer window "~S is not defined." symbol)
(let ((text (with-output-to-string (s)
(format s "(~S" symbol))
(if (null arglist)
(write-char #\) s)
(progn (when *arglist-show-function-name*
(write-char #\Space s))
(arglist-to-stream symbol s)
(write-char #\) s)))))))
(set-mini-buffer window "~A" text)))))
(defmethod ed-improved-arglist ((window fred-mixin))
(flet ((function-not-found ()
(set-mini-buffer window "Can't find current function.")
(return-from ed-improved-arglist nil)))
(let ((b (fred-buffer window)))
(when (> (buffer-size b) 0)
(do* ((pos (buffer-position b) (buffer-bwd-sexp b pos))
(char (buffer-char b (- pos 1)) (and pos (buffer-char b (- pos 1)))))
((and char (char-equal char #\())
(multiple-value-bind (symbol found-p prev-char)
(buffer-current-sexp b pos)
(declare (ignore prev-char))
(if (not found-p)
(when (eql symbol 'setf)
(setq pos (buffer-skip-fwd-wsp&comments b (buffer-fwd-sexp b pos)
(let ((what (buffer-current-sexp b pos)))
(when (and (consp what) ; What about symbol macros?
(atom (car what)))
(setq symbol `(setf ,(car what)))))))
(display-arglist symbol window)))))
(when (or (null pos)
;; Stop searching backwards when we get to the beginning of
;; a top-level definition.
(and (= 0 (buffer-column b pos))
(char-equal #\( (buffer-char b pos))))
;;; This replaces the normal ed-arglist binding, but the old version can still
;;; be accessed with Space if *arglist-on-space* is T.
(comtak-set-key *control-x-comtab* '(:control #\a) 'ed-improved-arglist)
------- End of Forwarded Message