[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Flymake under plain emacs in Mac OS X Terminal
From: |
Scott Heftler |
Subject: |
Re: Flymake under plain emacs in Mac OS X Terminal |
Date: |
Fri, 25 Apr 2008 21:12:44 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) |
Here’s one solution, since nobody's responding ...
(defun SS-fly-pop ()
"CSH: Show error using my popup function."
(interactive)
(let* ((line (count-lines 1 (1+ (point))))
(err-cdr (car (cdr (assoc line flymake-err-info))))
next-msg final-msg)
(while err-cdr
(setq next-msg (aref (pop err-cdr) 4))
(setq final-msg (cons next-msg final-msg)))
(PO-popup-picker final-msg 'show)))
-----------------------------------------------------------------------------
* In case you care, the popup function (which I use for everything) is
as follows ...
(defun PO-popup-picker (string-list &optional style prompt speak-fun)
"CSH: Shows pop-up index for STRING-LIST and returns pick number.
Just show (no pick) if STRING-LIST is a string or if STYLE is 'show or
'speak. Allowing speaking if STYLE is 'speak, cleaning the string with
optional SPEAK-FUN."
(let* ((map (copy-keymap gPO-empty-map))
(pop-buf (get-buffer-create "*LIL-POPUP*"))
(show-nums-p (and (not (stringp string-list))
(not (or (equal style 'speak)
(equal style 'show)))))
(counter 0)
(min 1)
(max (length string-list))
(pick 0))
(when (stringp string-list)
(setq string-list (list string-list)))
(save-window-excursion
(split-window-vertically)
(other-window 1)
(switch-to-buffer pop-buf)
(erase-buffer)
(PO-popup-mode)
(while string-list
(setq counter (1+ counter))
(if show-nums-p
(insert (format "%3d> %s\n" counter (pop string-list)))
(insert (pop string-list) "\n")))
(set-buffer-modified-p nil)
(fit-window-to-buffer)
(goto-char (point-min))
;; You have to use `read-from-minibuffer' (and not
;; `read-char') in order to allow scrolling.
(cond
((equal style 'speak)
(define-key map "s" '(lambda () (interactive)
(BR-buf-read "(BR)(Pop)" pop-buf speak-fun)))
(read-from-minibuffer "Type `s' to speak [RET quits] " nil map)
(when (get-process "(BR)(Pop)")
(delete-process "(BR)(Pop)")))
((not show-nums-p)
(read-from-minibuffer "[RET quits] " nil map))
(t
(setq pick (sure-read-number min max style
prompt (map-add-nums map)))))
(kill-buffer pop-buf))
pick))
-----------------------------------------------------------------------------
* In case you again care, the `sure-read-number' function is ...
(defun sure-read-number (min max &optional force-pick prompt map)
"CSH: Read from minibuffer; making sure number is in range.
Do not include colon in PROMPT."
(let ((map (or map (copy-keymap gSS-number-map)))
(prompt (or prompt "Pick a number"))
(not-ready t)
opt opt-num)
(if force-pick
(setq prompt (concat prompt ": "))
(setq prompt (concat prompt " [RET quits] ")))
(while not-ready
(setq opt (read-from-minibuffer prompt nil map))
(setq opt-num (string-to-number opt))
(cond
((string-match "[^0-9]" opt)
(message "<(Choice must be a number)>") (sit-for 2))
((and (not (equal opt ""))
(or (< opt-num min) (> opt-num max)))
(message "<(Choose between %d and %d)>" min max) (sit-for 2))
((and force-pick (equal opt ""))
(message "<(You must pick a number)>") (sit-for 2))
(t
(setq not-ready nil)
(if (equal opt "")
(setq opt nil)
(setq opt (string-to-number opt))))))
opt))