From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Toio little error information from widgets
Date: Wed, 07 Feb 2007 00:53:29 +0100 [thread overview]
Message-ID: <45C914F9.1050405@gmail.com> (raw)
The following code has an error. This error is however very hard to
detect. I do not get a traceback, it just behaves very strange.
Try the following:
emacs -Q
(eval the code below)
M-x customize-option RET temp-cust2 RET
Then click INS. It does not work as I expect. (To get it working
uncomment the line
;;(or (eq value 'fundamental-mode)
and the corresponding ")" in the code.
What could be done about this?
Here is the code:
(defun major-modep(value)
(let ((sym-name (symbol-name value)))
;; Do some reasonable test to find out if it is a major mode.
;; Load autoloaded mode functions.
;;
;; Fix-me: Maybe test for minor modes? How was that done?
(when (and (fboundp value)
(< 5 (length sym-name))
(string= "-mode" (substring sym-name (- (length
sym-name) 5)))
(if (and (listp (symbol-function value))
(eq 'autoload (car (symbol-function value))))
(progn
(message "loading ")
(load (cadr (symbol-function value)) t t))
t)
;;(or (eq value 'fundamental-mode)
(intern-soft (concat sym-name "-hook"))
(boundp (intern-soft (concat sym-name "-hook"))))
;;)
t)))
(define-widget 'major-mode-function2 'function
"A major mode lisp function."
:complete-function (lambda ()
(interactive)
(lisp-complete-symbol 'major-modep))
:prompt-match 'major-modep
:prompt-history 'widget-function-prompt-value-history
:match-alternatives '(major-modep)
:validate (lambda (widget)
(unless (major-modep (widget-value widget))
(widget-put widget :error (format "Invalid function: %S"
(widget-value widget)))
widget))
:value 'fundamental-mode
:tag "Major mode function")
(defcustom temp-cust2 nil
"doc"
:type '(alist :key-type major-mode-function2
:value-type (set
(list :tag "Highlighting on" (const hion)
boolean)
(list :tag "Highlighting" (const hili)
function)
(list :tag "Goto" (const goto) function)
(list :tag "Next" (const next) function)
(list :tag "Prev" (const next) function)
)))
next reply other threads:[~2007-02-06 23:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-06 23:53 Lennart Borgman (gmail) [this message]
2007-02-07 0:08 ` Toio little error information from widgets Daniel Brockman
2007-02-07 0:17 ` Lennart Borgman (gmail)
2007-02-07 23:47 ` Lennart Borgman (gmail)
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=45C914F9.1050405@gmail.com \
--to=lennart.borgman@gmail.com \
--cc=emacs-devel@gnu.org \
/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.