Sorry for the delay, Juri Linkov writes: >>>> the below patch adds the commands occur-word-at-mouse and >>>> occur-symbol-at-mouse, and a function for context-menu-mode to occur >>>> words or symbols where the context menu was invoked. >>>> >>>> Would there be any interest in adding such a functionality? >>> >>> Thanks. There is a new function 'thing-at-mouse' with a new arg 'click' >>> added today that you can use instead of 'thing-at-point'. >>> You can see an example in lisp/net/dictionary.el. >> >> I see, but I wonder why dictionary.el directly manipulates >> context-menu-functions with add-hook. > > The reasoning was the following: by default, dictionary.el is not loaded, > so its context menu item is not used. But when the user wants to use > dictionary.el and explicitly loads it, then automatically provide also > its context menu item. > > This reasoning can't be applied to occur, because occur in replace.el > is pre-loaded. > >> +(defun occur-word-at-mouse (event) >> + "Display an occur buffer for the word at EVENT." >> + (interactive "e") >> + (occur (thing-at-mouse event 'word t))) >> + >> +(defun occur-symbol-at-mouse (event) >> + "Display an occur buffer for the symbol at EVENT." >> + (interactive "e") >> + (occur (thing-at-mouse event 'symbol t))) > > Thanks, this is almost perfect. What remains to do is to create > a regexp that matches only words/symbols. You can see how > 'isearch-occur' converts a string to a word/symbol regexp by using > '(funcall isearch-regexp-function isearch-string)' before calling 'occur'. Ok, I've tried it here: