From: Leo <sdl.web@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Thierry Volpiatto <thierry.volpiatto@gmail.com>, emacs-devel@gnu.org
Subject: Re: eldoc support with M-:
Date: Wed, 05 Oct 2011 17:20:58 +0800 [thread overview]
Message-ID: <m1ehyrdcat.fsf@gmail.com> (raw)
In-Reply-To: <jwvhb3sqjxb.fsf-monnier+INBOX@gnu.org> (Stefan Monnier's message of "Sat, 01 Oct 2011 21:12:16 -0400")
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]
On 2011-10-02 09:12 +0800, Stefan Monnier wrote:
> [ Moved away from gnu.emacs.sources where it doesn't belong any more. ]
>
>>> you will find now last version of eldoc-eval.el in GNU ELPA.
>> I wonder if it makes sense to provide a message-function to customise
>> how `message' posts its messages.
>
> I think doing it for `message' is a bit too radical. But an
> eldoc-message-function hook would be perfectly fine, and I still hope
> (despite Thierry's failure to figure out how) that such a hook can be
> used to simplify (and integrate) eldoc-eval.el.
>
>
> Stefan
Sounds good. How about something as shown in the attachment?
Leo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: eldoc-modeline --]
[-- Type: text/x-diff, Size: 2363 bytes --]
=== modified file 'lisp/emacs-lisp/eldoc.el'
--- lisp/emacs-lisp/eldoc.el 2011-01-25 04:08:28 +0000
+++ lisp/emacs-lisp/eldoc.el 2011-10-05 09:15:52 +0000
@@ -146,6 +146,11 @@
"Idle time delay currently in use by timer.
This is used to determine if `eldoc-idle-delay' is changed by the user.")
+(defvar eldoc-message-function nil
+ "The function used by `eldoc-message' to display messages.
+It should receive the same arguments as `message'. If this is
+nil, `eldoc-minibuffer-message' is used.")
+
\f
;;;###autoload
(define-minor-mode eldoc-mode
@@ -185,8 +190,30 @@
(setq eldoc-current-idle-delay eldoc-idle-delay)
(timer-set-idle-time eldoc-timer eldoc-idle-delay t))))
+(defvar eldoc-mode-line-string nil)
+(put 'eldoc-mode-line-string 'risky-local-variable t)
+
+(defun eldoc-minibuffer-message (format-string &rest args)
+ "Show messages in the mode-line when in the minibuffer.
+Otherwise, behave like function `message'."
+ (if (minibufferp)
+ (progn
+ (with-current-buffer (window-buffer (minibuffer-selected-window))
+ (unless (assq 'eldoc-mode-line-string mode-line-format)
+ (push '(eldoc-mode-line-string (" " eldoc-mode-line-string " "))
+ mode-line-format)))
+ (add-hook 'minibuffer-exit-hook
+ (lambda () (setq eldoc-mode-line-string nil))
+ nil t)
+ (and (stringp format-string)
+ (setq eldoc-mode-line-string
+ (apply 'format format-string args)))
+ (force-mode-line-update))
+ (apply 'message format-string args)))
+
(defun eldoc-message (&rest args)
- (let ((omessage eldoc-last-message))
+ (let ((omessage eldoc-last-message)
+ (msgfunc (or eldoc-message-function #'eldoc-minibuffer-message)))
(setq eldoc-last-message
(cond ((eq (car args) eldoc-last-message) eldoc-last-message)
((null (car args)) nil)
@@ -200,8 +227,8 @@
;; they are Legion.
;; Emacs way of preventing log messages.
(let ((message-log-max nil))
- (cond (eldoc-last-message (message "%s" eldoc-last-message))
- (omessage (message nil)))))
+ (cond (eldoc-last-message (funcall msgfunc "%s" eldoc-last-message))
+ (omessage (funcall msgfunc nil)))))
eldoc-last-message)
;; This function goes on pre-command-hook for XEmacs or when using idle
next prev parent reply other threads:[~2011-10-05 9:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87liy3t6rk.fsf@gmail.com>
[not found] ` <20110519.175536.23311605.rubikitch@ruby-lang.org>
[not found] ` <87hb8rt4ha.fsf@gmail.com>
[not found] ` <87liw5z8sl.fsf@gmail.com>
[not found] ` <87aabj82sq.fsf@gmail.com>
[not found] ` <87vcsazaia.fsf@gmail.com>
[not found] ` <m1ty7sdh11.fsf@gmail.com>
2011-10-02 1:12 ` eldoc support with M-: Stefan Monnier
2011-10-05 9:20 ` Leo [this message]
2011-10-05 16:29 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1ehyrdcat.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=thierry.volpiatto@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.