From: Kevin Ryde <user42@zip.com.au>
To: bug-gnu-emacs@gnu.org
Subject: bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error
Date: Sat, 05 Dec 2009 09:44:42 +1100 [thread overview]
Message-ID: <87ws12jr51.fsf@blah.blah> (raw)
checkdoc-comment-style-hooks is run by checkdoc-file-comments-engine
with run-hook-with-args-until-success, which means if one of the hook
functions returns an error string (as described in the hook's docstring)
then no further functions are run.
I hoped the hook functions would instead run like the builtin checks of
checkdoc-file-comments-engine,
(setq err (or (some check)
err))
so that all checks are always run, with an error reported if any one of
them reports an error.
Or alternately perhaps I misunderstand the docstring of
checkdoc-comment-style-hooks, and that a "problem discovered" means
something fatal and unrecoverable, or something, and that hook functions
should almost always return nil no matter what they find.
I threw down the few lines below for a hook run which returns the last
true value, but I'm not sure I like it much. An alternative to picking
out a list of functions from a hook might be a
"run-hook-with-accumulator-function" or even a "map-hook" -- unless that
exists already.
(defun checkdoc-run-hooks-last-true (hookvar)
"Run hooks in HOOKVAR and return the last true value."
(let (ret)
(dolist (func (checkdoc-hook-functions hookvar))
(setq ret (or (funcall func) ret)))))
(defun checkdoc-hook-functions (hookvar)
"Return a list of functions HOOKVAR should run.
HOOKVAR can be a single function or list of functions, the return
is always a list. `t' in a buffer-local value means use the
global `default-value' at that point, and it can likewise be a
function or list."
(let ((hooks (symbol-value hookvar)))
(if (and hooks
;; same test as run_hook_with_args()
(or (not (consp hooks))
(eq 'lambda (car hooks))))
(list hooks) ;; single function listified
;; expand `t' to global value
(apply 'append
(mapcar (lambda (func)
(if (eq t func)
(let ((global (default-value hookvar)))
;; same test as run_hook_with_args()
(if (or (not (consp global))
(eq 'lambda (car global)))
(list global)
global))
(list func)))
hooks)))))
In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
of 2009-09-14 on raven, modified by Debian
configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''
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: en_AU
value of $XMODIFIERS: nil
locale-coding-system: iso-latin-1-unix
default-enable-multibyte-characters: t
next reply other threads:[~2009-12-04 22:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 22:44 Kevin Ryde [this message]
2016-07-09 13:27 ` bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error Andrew Hyatt
2019-08-16 19:14 ` Alex Branham
2019-08-20 17:21 ` Andrew Hyatt
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ws12jr51.fsf@blah.blah \
--to=user42@zip.com.au \
--cc=5126@emacsbugs.donarmstrong.com \
--cc=bug-gnu-emacs@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 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).