all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* suggestion for imenu
@ 2002-06-19 12:39 Konstantin Malakhanov
  0 siblings, 0 replies; only message in thread
From: Konstantin Malakhanov @ 2002-06-19 12:39 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (i386-msvc-nt5.0.2195)
 of 2002-06-18 on TRITON
configured using `configure --with-msvc (12.00)'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: DEU
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: nil

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

It's not a bug, its a suggestion for imenu.

I introduce a new option for imenu: if imenu call finds a reasonalble
completion, use it without prompt, with possibilities 'never (current
imenu behaviour), for mouse event only and always. 

Notice that this is different from
imenu-always-use-completion-buffer-p, which just select between asking
in completion buffer or as mouse menu.

I don't like the standard way if imenu, where I have always confirm
jump to a function, whether imenu has found a suitable name at the
point or not. With the new option , if imenu "sees" a suitable name,
it just go to it without confirmation. Next, I patch imenu to set
point to where the mouse click occurs, if imenu is called via
mouse. So now I can bind (define-key esc-map [mouse-1] 'imenu)

and with a click at the function name somewhere in the source code I
get it's definition. Speeds up things a lot!

A patch is beneath.
--- /cygdrive/c/emacs-21.2/lisp/imenu.el	Sun Jul 15 16:15:34 2001
+++ /cygdrive/h/emacs/imenu.el	Tue Dec  4 09:01:38 2001
@@ -174,6 +174,13 @@
   :type 'string
   :group 'imenu)
 
+(defcustom imenu-use-default-completion nil
+  "*If imenu call finds a reasonalble completion, use it without prompt." 
+  :type '(choice (const :tag "On Mouse" nil)
+		 (const :tag "Never - use prompt anyway" never)
+		 (other :tag "Always" t))
+  :group 'imenu)
+
 ;;;###autoload
 (defvar imenu-generic-expression nil
   "The regex pattern to use for creating a buffer index.
@@ -870,6 +877,8 @@
 
 Returns t for rescan and otherwise a position number."
   ;; Create a list for this buffer only when needed.
+  (if (listp last-nonmenu-event) 
+      (mouse-set-point last-nonmenu-event))
   (let ((name (thing-at-point 'symbol))
 	choice
 	(prepared-index-alist
@@ -883,6 +892,10 @@
 	  ((and name (imenu--in-alist name prepared-index-alist))
 	   (setq prompt (format "Index item (default %s): " name)))
 	  (t (setq prompt "Index item: ")))
+    (if (or (null name) ;; no name found
+	    (and (null imenu-use-default-completion) ;; use name if mouse & not mouse event 
+		 (not (listp last-nonmenu-event)))
+	    (eq imenu-use-default-completion 'never)) ;; never use name, always go though prompt
     (if (eq imenu-always-use-completion-buffer-p 'never)
   	(setq name (completing-read prompt
   				    prepared-index-alist
@@ -902,7 +915,7 @@
 	  ;; Make a completion question
 	  (setq name (completing-read prompt
 				      prepared-index-alist
-				      nil t nil 'imenu--history-list name)))))
+					  nil t nil 'imenu--history-list name))))))
     (cond ((not (stringp name))
 	   nil)
 	  ((string= name (car imenu--rescan-item))

-- 
Konstantin Malakhanov 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-06-19 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-19 12:39 suggestion for imenu Konstantin Malakhanov

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.