unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Defining your own defun breaks find-function-search-for-symbol
@ 2006-04-08  0:02 Bill Wohler
  2006-04-08 22:34 ` Richard Stallman
  2006-04-10 18:41 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Bill Wohler @ 2006-04-08  0:02 UTC (permalink / raw)


We've (the MH-E team) developed mh-defun-compat (and mh-defmacro-compat)
to provide either an alias or a definition to a function depending on
the availability of the function. I've also created functions like
mh-defcustom to strip :package-version from the option definition on
systems that do not support it.

The problem is that if perform describe-function or describe-variable on
the functions and variables that these functions define, and then click
on the file in which they are defined, you get an error:

  Cannot find definition of `mh-letter-fill-column' in library `mh-e.el'

This can be fixed by modifying the find-*-regexp variables as follows:

  (eval-after-load "find-func"
    '(progn
       (setq find-function-regexp
	     (replace-regexp-in-string
	      "(def\\\\(" "(\\(mh-\\)?def\\(\\(un\\|macro\\)-compat\\|"
	      find-function-regexp t t))
       (setq find-variable-regexp
	     (replace-regexp-in-string
	      "(def" "(\\(mh-\\)?def" find-variable-regexp t t))
       (if (boundp 'find-face-regexp)
	   (setq find-face-regexp
		 (replace-regexp-in-string
		  "(def" "(\\(mh-\\)?def" find-face-regexp t t)))))

This code is in mh-e.el (not yet checked in) and works in Emacs 22 and
Emacs 21. Does anyone see any pitfalls of this approach? Can you think
of a better solution to this or the original problem?

p.s. Font-lock is broken for mh-defun-compat and friends too. Pity that
font-lock and find-function didn't share the same regexp for recognizing
a function/variable/face.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-04-11 17:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-08  0:02 Defining your own defun breaks find-function-search-for-symbol Bill Wohler
2006-04-08 22:34 ` Richard Stallman
2006-04-10  0:06   ` Bill Wohler
2006-04-10 18:26     ` Richard Stallman
2006-04-10 22:35       ` Bill Wohler
2006-04-11 16:57         ` Richard Stallman
2006-04-11 17:10           ` Bill Wohler
2006-04-10 18:41 ` Stefan Monnier
2006-04-10 21:34   ` Bill Wohler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).