emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/info-xref.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/info-xref.el
Date: Tue, 11 Feb 2003 16:00:58 -0500

Index: emacs/lisp/info-xref.el
diff -c emacs/lisp/info-xref.el:1.2 emacs/lisp/info-xref.el:1.3
*** emacs/lisp/info-xref.el:1.2 Tue Feb 11 04:02:37 2003
--- emacs/lisp/info-xref.el     Tue Feb 11 16:00:58 2003
***************
*** 106,120 ****
                        (goto-char (point-min))
                        (if (re-search-forward
                             "address@hidden \t]+\\([^ \t\n]+\\)[ \t]*"
!                            (save-excursion (forward-line 100) (point)) t)
                            (expand-file-name (match-string 1)))))))
             (prompt (if default-filename
                         (format "Info file (%s): " default-filename)
                       "Info file: ")))
!       (read-file-name prompt
!                       default-directory
!                       default-filename
!                       t))))
    (info-xref-check-list (list filename)))
  
  ;;;###autoload
--- 106,117 ----
                        (goto-char (point-min))
                        (if (re-search-forward
                             "address@hidden \t]+\\([^ \t\n]+\\)[ \t]*"
!                            (line-beginning-position 100) t)
                            (expand-file-name (match-string 1)))))))
             (prompt (if default-filename
                         (format "Info file (%s): " default-filename)
                       "Info file: ")))
!       (read-file-name prompt nil default-filename t))))
    (info-xref-check-list (list filename)))
  
  ;;;###autoload
***************
*** 139,153 ****
  things are returned if for instance a source code directory is in the path."
  
    (info-initialize) ;; establish Info-directory-list
!   (apply 'append
           (mapcar
            (lambda (dir)
              (let ((result nil))
                (dolist (name (directory-files dir t))
!                 (if (and (not (file-directory-p name))
!                          (not (info-xref-subfile-p name)))
!                     (setq result (cons name result))))
!               (reverse result)))
            (append Info-directory-list Info-additional-directory-list))))
  
  (defun info-xref-subfile-p (filename)
--- 136,149 ----
  things are returned if for instance a source code directory is in the path."
  
    (info-initialize) ;; establish Info-directory-list
!   (apply 'nconc
           (mapcar
            (lambda (dir)
              (let ((result nil))
                (dolist (name (directory-files dir t))
!                 (unless (or (file-directory-p name) (info-xref-subfile-p 
name))
!                 (push name result)))
!               (nreverse result)))
            (append Info-directory-list Info-additional-directory-list))))
  
  (defun info-xref-subfile-p (filename)
***************
*** 211,225 ****
            "\\*[Nn]ote[ \n\t]+[^:]*:[ \n\t]+\\(\\(([^)]+)\\)[^.,]+\\)[.,]"
            nil t)
      (let* ((file (match-string 2))
!            (node (info-xref-whitespace (match-string 1))))
        ;; 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)))
!           (setq info-xref-xfile-alist (cons (cons file found)
!                                             info-xref-xfile-alist))
!           (if (not 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)
--- 207,222 ----
            "\\*[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)
***************
*** 231,239 ****
  (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)
!     (setq info-xref-filename-heading "")
!     (insert str)))
  
  ;; When asking Info-goto-node to fork, *info* needs to be the current
  ;; buffer, otherwise it seems to clone the current buffer but then do the
--- 228,235 ----
  (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
  ;; buffer, otherwise it seems to clone the current buffer but then do the
***************
*** 247,253 ****
  ;; this difference by checking before killing.
  ;;
  (defun info-xref-goto-node-p (node)
!   "Return t if it's possible to goto the given NODE."
    (let ((oldbuf (current-buffer)))
      (save-excursion
        (save-window-excursion
--- 243,249 ----
  ;; this difference by checking before killing.
  ;;
  (defun info-xref-goto-node-p (node)
!   "Return t if it's possible to go to the given NODE."
    (let ((oldbuf (current-buffer)))
      (save-excursion
        (save-window-excursion
***************
*** 262,288 ****
                (error nil))
            (unless (equal (current-buffer) oldbuf)
              (kill-buffer (current-buffer))))))))
- 
- ;; Can this be done better?
- (defun info-xref-whitespace (str)
-   "In STR, convert tabs and newlines to spaces, collapse repeated spaces."
-   (setq str (copy-sequence str))
-   (dotimes (i (length str))
-     (let ((c (elt str i)))
-       (if (or (= c ?\n)
-               (= c ?\t))
-           (aset str i ? ))))
-   (let ((dst 0)
-         (prev -1))
-     (dotimes (i (length str))
-       (let ((c (elt str i)))
-         (unless (and (= c ? )
-                      (= prev ? ))
-           (aset str dst c)
-           (setq dst (1+ dst)))
-         (setq prev c)))
-     (setq str (substring str 0 dst)))
-   str)
  
  (provide 'info-xref)
  
--- 258,263 ----




reply via email to

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