emacs-devel
[Top][All Lists]
Advanced

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

Re: Reducing mouse-dependency In Emacs.


From: Luc Teirlinck
Subject: Re: Reducing mouse-dependency In Emacs.
Date: Mon, 11 Aug 2003 21:49:53 -0500 (CDT)

The following (still strictly experimental) version of automatic
help-echo display eliminates the main obnoxiousness of the original
version.  In the original version, you could be asked a question in
the minibuffer, have to think about the answer, and suddenly the
question disappears for some useless help-echo.  The following version
prevents that.  It will only display the help-echo if the minibuffer
is empty or contains "Quit".  So, if you have "Mark set" in the echo
area, you have to do C-g or otherwise clear the echo area (say by
moving point) to get the help-echo.  Seems better than to miss an
important message, if not paying attention, by having it overridden by
help-echo.  Anyway, I wound up finding the original version unbearable
in actual use.  I found the one below much better.

===File ~/newhelp-timer.el==================================
(defun print-local-help (&optional timer)
  "Display help related text or overlay properties.
This displays a short help message in the echo area, namely the
value of the `short-help' text or overlay property at point.  If
there is no `short-help' property at point, but there is a
`help-echo' property whose value is a string, then that is
printed instead.

The timer argument is meant for use in `run-with-idle-timer' and
prevents display of a message in case there is no help."
  (interactive)
  (let ((short (get-char-property (point) 'short-help))
        (echo (get-char-property (point) 'help-echo)))
    (cond (short (message "%s" short))
          ((stringp echo) (message "%s" echo))
          ((not timer) (message "No local help at point")))))

(defvar delay 1)

(defvar local-help-timer nil)

(unless local-help-timer
  (setq local-help-timer
        (run-with-idle-timer delay t #'maybe-display-help)))
   
(defun maybe-display-help ()
  (unless (and (current-message)
               (not (string= (current-message) "Quit")))
    (print-local-help t)))

(defun cancel-echo ()
  (interactive)
  (cancel-timer local-help-timer)
  (setq local-help-timer nil))

(global-set-key "\C-h\C-l" 'print-local-help)
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]