On Tuesday 09 June 2009 13:14:15 Eric M. Ludlam wrote:
> The only way I can think to debug this (as I don't have this problem)
> is to improve the debug info, via the following steps:
> M-x find-function RET find-file-noselect RET
> C-M-x ; this is eval-defun
> Now find-file-noselect will show more detail in the stack when it bombs
> out, and hopefully that will point the way.
Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
signal(wrong-type-argument (arrayp nil))
(condition-case data (progn (set-buffer-major-mode buf) (set-buffer buf)
(erase-buffer) (condition-case nil ... ...) (unless buffer-file-truename ...)
(setq buffer-file-number number) (and find-file-use-truenames ...) (setq
default-directory ...) (and ... ...) (if rawfile nil ... ...)) (t (kill-buffer
buf) (signal ... ...)))
(save-excursion (setq buf (create-file-buffer filename)) (condition-case
data (progn ... ... ... ... ... ... ... ... ... ...) (t ... ...)))
(if buf (or nowarn (verify-visited-file-modtime buf) (cond ... ... ...))
(save-excursion (setq buf ...) (condition-case data ... ...)))
(let* ((buf ...) (truename ...) (number ...) (error nil)) (when (and buf ...
...) (save-excursion ... ...)) (if buf (or nowarn ... ...) (save-excursion ...
(if (file-directory-p filename) (if (and ... find-file-run-dired) (dired-
noselect ...) (error "%s is a directory" filename)) (let* (... ... ... ...)
(when ... ...) (if buf ... ...) buf))
I added the source of find-file-noselect of my XEmacs 21.4.21 at the end of
this mail for reference.
> > Comparing a broken and a working semantic.cache file I found the
> > following in the section of the offending source file:
> > All lines in the working version containing [<x> <y>], e.g.
> > '( ("aaa.h" include nil nil [1 17])
> > ( ("public" label nil (reparse-symbol classsubparts) [44 51])
> > ( ("x" variable (:type "int") (reparse-symbol arg-sub-list) [79 86]))
> > contain only a nil in the broken version, i.e.
> > '( ("aaa.h" include nil nil nil)
> > ( ("public" label nil (reparse-symbol classsubparts) nil)
> > ( ("x" variable (:type "int") (reparse-symbol arg-sub-list) nil))
Don't you think it could have something to do with the above? Then the
question might be: Why does semantic sometimes save nil instead of the tag
(defun find-file-noselect (filename &optional nowarn rawfile)
"Read file FILENAME into a buffer and return the buffer.
If a buffer exists visiting FILENAME, return that one, but
verify that the file has not changed since visited or saved.
The buffer is not selected, just returned to the caller.
If NOWARN is non-nil, warning messages will be suppressed.
If RAWFILE is non-nil, the file is read literally."
(setq filename (abbreviate-file-name (expand-file-name filename)))
(if (file-directory-p filename)
(if (and (fboundp 'dired-noselect) find-file-run-dired)
(dired-noselect (if find-file-use-truenames
(abbreviate-file-name (file-truename filename))
(error "%s is a directory" filename))
(let* ((buf (get-file-buffer filename))
(truename (abbreviate-file-name (file-truename filename)))
(number (nthcdr 10 (file-attributes truename)))
; ;; Find any buffer for a file which has same truename.
; (other (and (not buf) (find-buffer-visiting filename)))
; ;; Let user know if there is a buffer with the same truename.
; (if (and (not buf) same-truename (not nowarn))
; (message "%s and %s are the same file (%s)"
; filename (buffer-file-name same-truename)
; (if (and (not buf) same-number (not nowarn))
; (message "%s and %s are the same file"
; filename (buffer-file-name same-number))))
; ;; Optionally also find that buffer.
; (if (or find-file-existing-other-name find-file-visit-truename)
; (setq buf (or same-truename same-number)))
(when (and buf
(or find-file-compare-truenames find-file-use-truenames)
(if (not (string-equal buffer-file-name filename))
(message "%s and %s are the same file (%s)"
(cond ((not (file-exists-p filename))
(error "File %s no longer exists!" filename))
;; Certain files should be reverted automatically
;; if they have changed on disk and not in the buffer.
((and (not (buffer-modified-p buf))
(dolist (rx revert-without-query nil)
(when (string-match rx filename)
(message "Reverting file %s..." filename)
(revert-buffer t t)
(message "Reverting file %s... done" filename)))
(if (string= (file-name-nondirectory filename)
(if (buffer-modified-p buf)
(gettext "File %s changed on disk. Discard your edits? ")
(gettext "File %s changed on disk. Reread from disk? "))
(if (buffer-modified-p buf)
(gettext "File %s changed on disk. Discard your edits in %s? ")
(gettext "File %s changed on disk. Reread from disk into %s? "))
(revert-buffer t t)))))
;; Else: we must create a new buffer for filename
;;; The truename stuff makes this obsolete.
;;; (let* ((link-name (car (file-attributes filename)))
;;; (linked-buf (and (stringp link-name)
;;; (get-file-buffer link-name))))
;;; (if (bufferp linked-buf)
;;; (message "Symbolic link to file in buffer %s"
;;; (buffer-name linked-buf))))
(setq buf (create-file-buffer filename))
;; Catch various signals, such as QUIT, and kill the buffer
;; in that case.
(insert-file-contents-literally filename t)
(insert-file-contents filename t))
(when (and (file-exists-p filename)
(not (file-readable-p filename)))
(signal 'file-error (list "File is not readable" filename)))
;; Unconditionally set error
(setq error t)
;; Run find-file-not-found-hooks until one returns non-nil.
;; If they fail too, set error.
(setq error t)))))
;; Find the file's truename, and maybe use that as visited name.
;; automatically computed in XEmacs, unless jka-compr was used!
(setq buffer-file-truename truename))
(setq buffer-file-number number)
;; This should be in C. Put pathname
;; abbreviations that have been explicitly
;; requested back into the pathname. Most
;; importantly, strip out automounter /tmp_mnt
;; directories so that auto-save will work
(setq buffer-file-name (abbreviate-file-name buffer-file-name)))
;; Set buffer's default directory to that of the file.
(setq default-directory (file-name-directory buffer-file-name))
;; Turn off backup files for certain file names. Since
;; this is a permanent local, the major mode won't eliminate it.
(and (not (funcall backup-enable-predicate buffer-file-name))
(setq backup-inhibited t)))
;; #### FSF 20.3 sets buffer-file-coding-system to
;; `no-conversion' here. Should we copy? It also
;; makes `find-file-literally' a local variable
;; and sets it to t.
(after-find-file error (not nowarn))
(setq buf (current-buffer))))
(signal (car data) (cdr data))))