emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: info-xref empty filenames


From: Kevin Ryde
Subject: Re: info-xref empty filenames
Date: Wed, 25 Feb 2004 08:36:08 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Juri Linkov <address@hidden> writes:
>
> Since your papers are apparently OK, I want to suggest you to
> implement a new checking rule in info-xref.el.  Customization
> definitions (defcustom) can have the keyword `:link' with a link
> to an Info node in a `custom-manual' or `info-link' field.

Actually, I wrote the code below a while back to do that.  It's pretty
rough, errors are only printed with `message', and I seem to have
omitted the name of the offending variable, but I think it vaguely
works so far as it goes.

The messy bit is forcibly loading all the autoloads.  I forget
exactly, but I'm pretty sure I had to suppress errors because not
everything would load successfully.  Not sure if loading in a crazy
order is/was the problem, or if packages are at fault.  Maybe others
have more experience with such forcible loading.



;; 2003


(require 'info-xref)

;; reftex-vars doesn't autoload quite right on its own
(require 'reftex)


(defun cusxref-autoloads-list ()
  "Return a list of loads and requires for all custom variables.
The list is in no particular order.  Duplicates have been removed."
  (let ((result nil))
    (mapatoms (lambda (symbol)
                (dolist (i (get symbol 'custom-loads))
                  (add-to-list 'result i))))
    result))

(defun cusxref-load (cusxref-name)
  "Load CUSXREF-NAME, but suppress errors.
CUSXREF-NAME can be a symbol to `require' or a filename string to `load'."
  ;; The NOERROR parameter to `load' doesn't cover sub-loads, it seems, so
  ;; protect ourselves explicitly.
  (condition-case cause
      (if (symbolp cusxref-name)
          (require cusxref-name)
        (load cusxref-name))
    (error
     (message "Warning: cannot load: %s: %s\n" cusxref-name cause))))

(defun cusxref-load-all-autoloads ()
  "Load all files mentioned in custom variable loads or requires."
  (message "loaded %d"
           (length 
            (mapcar 'cusxref-load (cusxref-autoloads-list)))))

(defun cusxref-missing ()
  (let ((good 0)
        (bad  0))
    (mapatoms (lambda (symbol)
                (dolist (link (get symbol 'custom-links))
                  (when (eq 'custom-manual (car link))
                    (if (info-xref-goto-node-p (cadr link))
                        (setq good (1+ good))
                      (setq bad (1+ bad))
                      (message "Cannot open: %s" (cadr link)))))))
    (message "%d good, %d bad\n" good bad)))


(cusxref-load-all-autoloads)
(cusxref-missing)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]