[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Toio little error information from widgets
From: |
Lennart Borgman (gmail) |
Subject: |
Toio little error information from widgets |
Date: |
Wed, 07 Feb 2007 00:53:29 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 |
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)
)))
- Toio little error information from widgets,
Lennart Borgman (gmail) <=