unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* info-xref empty filenames
@ 2003-11-28 23:23 Kevin Ryde
  2004-02-16  0:43 ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2003-11-28 23:23 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

        * info-xref.el (info-xref-check-buffer): Report empty filename parts.
        Remove spurious node duplicate suppression, doesn't work, not wanted.
        (info-xref-output): Take format style args.

In particular this picks up the programs.texi problem (other message).


[-- Attachment #2: info-xref.el.empty.diff --]
[-- Type: text/plain, Size: 3304 bytes --]

*** info-xref.el.~1.4.~	Sat Sep  6 08:15:10 2003
--- info-xref.el	Sun Nov 23 07:46:57 2003
*************** (defun info-xref-check-buffer ()
*** 204,234 ****
  This should be the raw file contents, not `Info-mode'."
    (goto-char (point-min))
    (while (re-search-forward
!           "\\*[Nn]ote[ \n\t]+[^:]*:[ \n\t]+\\(\\(([^)]+)\\)[^.,]+\\)[.,]"
            nil t)
      (let* ((file (match-string 2))
             (node ;; Canonicalize spaces: we could use "[\t\n ]+" but
  	    ;; we try to avoid uselessly replacing " " with " ".
  	    (replace-regexp-in-string "[\t\n][\t\n ]*\\| [\t\n ]+" " "
  				      (match-string 1) t t)))
!       ;; see if the file exists, if we haven't tried it before
!       (unless (assoc file info-xref-xfile-alist)
!         (let ((found (info-xref-goto-node-p file)))
!           (push (cons file found) info-xref-xfile-alist)
!           (unless found
! 	    (info-xref-output (format "Not available to check: %s\n" file)))))
!       ;; if the file exists, try the node, if we haven't before
!       (when (cdr (assoc file info-xref-xfile-alist))
!         (unless (assoc node info-xref-xfile-alist)
            (if (info-xref-goto-node-p node)
                (setq info-xref-good (1+ info-xref-good))
              (setq info-xref-bad (1+ info-xref-bad))
!             (info-xref-output (format "No such node: %s\n" node))))))))
  
! (defun info-xref-output (str)
!   "Emit STR as an info-xref result message."
    (with-current-buffer info-xref-results-buffer
!     (insert info-xref-filename-heading str)
      (setq info-xref-filename-heading "")))
  
  ;; When asking Info-goto-node to fork, *info* needs to be the current
--- 204,236 ----
  This should be the raw file contents, not `Info-mode'."
    (goto-char (point-min))
    (while (re-search-forward
!           "\\*[Nn]ote[ \n\t]+[^:]*:[ \n\t]+\\(\\(([^)]*)\\)[^.,]+\\)[.,]"
            nil t)
      (let* ((file (match-string 2))
             (node ;; Canonicalize spaces: we could use "[\t\n ]+" but
  	    ;; we try to avoid uselessly replacing " " with " ".
  	    (replace-regexp-in-string "[\t\n][\t\n ]*\\| [\t\n ]+" " "
  				      (match-string 1) t t)))
!       (if (string-equal "()" file)
!           (info-xref-output "Empty filename part: %s\n" node)
!         ;; see if the file exists, if we haven't tried it before
!         (unless (assoc file info-xref-xfile-alist)
!           (let ((found (info-xref-goto-node-p file)))
!             (push (cons file found) info-xref-xfile-alist)
!             (unless found
!               (info-xref-output "Not available to check: %s\n" file))))
!         ;; if the file exists, try the node
!         (when (cdr (assoc file info-xref-xfile-alist))
            (if (info-xref-goto-node-p node)
                (setq info-xref-good (1+ info-xref-good))
              (setq info-xref-bad (1+ info-xref-bad))
!             (info-xref-output "No such node: %s\n" node)))))))
  
! (defun info-xref-output (str &rest args)
!   "Emit a `format'-ed message STR+ARGS to the info-xref output buffer."
    (with-current-buffer info-xref-results-buffer
!     (insert info-xref-filename-heading
!             (apply 'format str args))
      (setq info-xref-filename-heading "")))
  
  ;; When asking Info-goto-node to fork, *info* needs to be the current

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

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

* Re: info-xref empty filenames
  2003-11-28 23:23 info-xref empty filenames Kevin Ryde
@ 2004-02-16  0:43 ` Kevin Ryde
  2004-02-24  1:34   ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2004-02-16  0:43 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

I wrote:
>
>         * info-xref.el (info-xref-check-buffer): Report empty filename parts.
>         Remove spurious node duplicate suppression, doesn't work, not wanted.
>         (info-xref-output): Take format style args.

I'd like to re-propose this addition to my info-xref.  I think it got
lost while the cvs was down.


[-- Attachment #2: info-xref.el.empty.diff --]
[-- Type: text/plain, Size: 3304 bytes --]

*** info-xref.el.~1.4.~	Sat Sep  6 08:15:10 2003
--- info-xref.el	Sun Nov 23 07:46:57 2003
*************** (defun info-xref-check-buffer ()
*** 204,234 ****
  This should be the raw file contents, not `Info-mode'."
    (goto-char (point-min))
    (while (re-search-forward
!           "\\*[Nn]ote[ \n\t]+[^:]*:[ \n\t]+\\(\\(([^)]+)\\)[^.,]+\\)[.,]"
            nil t)
      (let* ((file (match-string 2))
             (node ;; Canonicalize spaces: we could use "[\t\n ]+" but
  	    ;; we try to avoid uselessly replacing " " with " ".
  	    (replace-regexp-in-string "[\t\n][\t\n ]*\\| [\t\n ]+" " "
  				      (match-string 1) t t)))
!       ;; see if the file exists, if we haven't tried it before
!       (unless (assoc file info-xref-xfile-alist)
!         (let ((found (info-xref-goto-node-p file)))
!           (push (cons file found) info-xref-xfile-alist)
!           (unless found
! 	    (info-xref-output (format "Not available to check: %s\n" file)))))
!       ;; if the file exists, try the node, if we haven't before
!       (when (cdr (assoc file info-xref-xfile-alist))
!         (unless (assoc node info-xref-xfile-alist)
            (if (info-xref-goto-node-p node)
                (setq info-xref-good (1+ info-xref-good))
              (setq info-xref-bad (1+ info-xref-bad))
!             (info-xref-output (format "No such node: %s\n" node))))))))
  
! (defun info-xref-output (str)
!   "Emit STR as an info-xref result message."
    (with-current-buffer info-xref-results-buffer
!     (insert info-xref-filename-heading str)
      (setq info-xref-filename-heading "")))
  
  ;; When asking Info-goto-node to fork, *info* needs to be the current
--- 204,236 ----
  This should be the raw file contents, not `Info-mode'."
    (goto-char (point-min))
    (while (re-search-forward
!           "\\*[Nn]ote[ \n\t]+[^:]*:[ \n\t]+\\(\\(([^)]*)\\)[^.,]+\\)[.,]"
            nil t)
      (let* ((file (match-string 2))
             (node ;; Canonicalize spaces: we could use "[\t\n ]+" but
  	    ;; we try to avoid uselessly replacing " " with " ".
  	    (replace-regexp-in-string "[\t\n][\t\n ]*\\| [\t\n ]+" " "
  				      (match-string 1) t t)))
!       (if (string-equal "()" file)
!           (info-xref-output "Empty filename part: %s\n" node)
!         ;; see if the file exists, if we haven't tried it before
!         (unless (assoc file info-xref-xfile-alist)
!           (let ((found (info-xref-goto-node-p file)))
!             (push (cons file found) info-xref-xfile-alist)
!             (unless found
!               (info-xref-output "Not available to check: %s\n" file))))
!         ;; if the file exists, try the node
!         (when (cdr (assoc file info-xref-xfile-alist))
            (if (info-xref-goto-node-p node)
                (setq info-xref-good (1+ info-xref-good))
              (setq info-xref-bad (1+ info-xref-bad))
!             (info-xref-output "No such node: %s\n" node)))))))
  
! (defun info-xref-output (str &rest args)
!   "Emit a `format'-ed message STR+ARGS to the info-xref output buffer."
    (with-current-buffer info-xref-results-buffer
!     (insert info-xref-filename-heading
!             (apply 'format str args))
      (setq info-xref-filename-heading "")))
  
  ;; When asking Info-goto-node to fork, *info* needs to be the current

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

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

* Re: info-xref empty filenames
  2004-02-16  0:43 ` Kevin Ryde
@ 2004-02-24  1:34   ` Juri Linkov
  2004-02-24 22:36     ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2004-02-24  1:34 UTC (permalink / raw)
  Cc: emacs-devel

Kevin Ryde <user42@zip.com.au> writes:
>>         * info-xref.el (info-xref-check-buffer): Report empty filename parts.
>>         Remove spurious node duplicate suppression, doesn't work, not wanted.
>>         (info-xref-output): Take format style args.
>
> I'd like to re-propose this addition to my info-xref.  I think it got
> lost while the cvs was down.

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.  I've
already found some broken links to Info nodes in some defcustoms,
but having a function in info-xref.el to perform such checks will
help to catch them all.

-- 
http://www.jurta.org/emacs/

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

* Re: info-xref empty filenames
  2004-02-24  1:34   ` Juri Linkov
@ 2004-02-24 22:36     ` Kevin Ryde
  2004-03-11  0:09       ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2004-02-24 22:36 UTC (permalink / raw)


Juri Linkov <juri@jurta.org> 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)

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

* Re: info-xref empty filenames
  2004-02-24 22:36     ` Kevin Ryde
@ 2004-03-11  0:09       ` Kevin Ryde
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Ryde @ 2004-03-11  0:09 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

This is what I ended up with for checking custom links, it goes on top
of the empty filenames change for info-xref.el I posted before.

        * info-xref.el (info-xref-check-all-custom): New function.


[-- Attachment #2: info-xref.el.custom.diff --]
[-- Type: text/plain, Size: 2943 bytes --]

*** info-xref.el.old	Thu Mar 11 09:58:11 2004
--- info-xref.el	Thu Mar 11 10:00:39 2004
***************
*** 264,269 ****
--- 264,327 ----
            (unless (equal (current-buffer) oldbuf)
              (kill-buffer (current-buffer))))))))
  
+ (defun info-xref-check-all-custom ()
+   "Check info references in all customize groups and variables.
+ `custom-manual' and `info-link' entries in the `custom-links' list are checked.
+ 
+ `custom-load' autoloads for all symbols are loaded in order to get all the
+ link information.  This will be a lot of lisp packages loaded, and can take
+ quite a while."
+ 
+   (interactive)
+   (pop-to-buffer info-xref-results-buffer t)
+   (erase-buffer)
+   (let ((info-xref-filename-heading ""))
+ 
+     ;; `custom-load-symbol' is not used, since it quietly ignores errors,
+     ;; but we want to show them (since they may mean incomplete checking).
+     ;;
+     ;; Just one pass through mapatoms is made.  There shouldn't be any new
+     ;; custom-loads setup by packages loaded.
+     ;;
+     (info-xref-output "Loading custom-load autoloads ...\n")
+     (require 'cus-start)
+     (require 'cus-load)
+     (let ((viper-mode nil)) ;; tell viper.el not to ask about viperizing
+       (mapatoms
+        (lambda (symbol)
+          (dolist (load (get symbol 'custom-loads))
+            (cond ((symbolp load)
+                   (condition-case cause (require load)
+                     (error
+                      (info-xref-output "Symbol `%s': cannot require '%s: %s\n"
+                                        symbol load cause))))
+                  ;; skip if previously loaded
+                  ((assoc load load-history))
+                  ((assoc (locate-library load) load-history))
+                  (t
+                   (condition-case cause (load load)
+                     (error
+                      (info-xref-output "Symbol `%s': cannot load \"%s\": %s\n"
+                                        symbol load cause)))))))))
+ 
+     ;; Don't bother to check whether the info file exists as opposed to just
+     ;; a missing node.  If you have the lisp then you should have the
+     ;; documentation, so missing node name will be the usual fault.
+     ;;
+     (info-xref-output "\nChecking custom-links references ...\n")
+     (let ((good 0)
+           (bad  0))
+       (mapatoms
+        (lambda (symbol)
+          (dolist (link (get symbol 'custom-links))
+            (when (memq (car link) '(custom-manual info-link))
+              (if (info-xref-goto-node-p (cadr link))
+                  (setq good (1+ good))
+                (setq bad (1+ bad))
+                (info-xref-output "Symbol `%s' (in %s): cannot goto node: %s\n"
+                                  symbol (symbol-file symbol) (cadr link)))))))
+       (info-xref-output "%d good, %d bad\n" good bad))))
+ 
  (provide 'info-xref)
  
  ;;; arch-tag: 69d4d528-69ed-4cc2-8eb4-c666a0c1d5ac

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

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

end of thread, other threads:[~2004-03-11  0:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-28 23:23 info-xref empty filenames Kevin Ryde
2004-02-16  0:43 ` Kevin Ryde
2004-02-24  1:34   ` Juri Linkov
2004-02-24 22:36     ` Kevin Ryde
2004-03-11  0:09       ` Kevin Ryde

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).