emacs-devel
[Top][All Lists]
Advanced

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

Re: 23.0.50; find-library scan-error "Unbalanced parenthesis"


From: martin rudalics
Subject: Re: 23.0.50; find-library scan-error "Unbalanced parenthesis"
Date: Thu, 24 Jan 2008 08:59:42 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> Here is a simple bug - I believe. I get the error
>
>   error: (scan-error "Unbalanced parentheses" 344 1)
>
> from find-libary
>
> To reproduce do
>
>   emacs -Q
>
> Paste these lines in the scratch buffer
>
> ;;(add-to-list 'load-path "c:/DL/emacs/org-5.13h/org-5.13h/")
> ;;(require 'org-install)
>
> Place cursor at beginning of second line and do
>
>   M-x find-library RET

The bug occurs (also) because `function-called-at-point' is a misnomer.
`find-tag-default' is allowed to return a symbol somewhere on the
current line.  `find-library' assumes that the "require" is right there
at point and tries to get out of a non-existent list.

You can reproduce a similar bug by putting point on the "require" in the
top-level string below when invoking `find-library':

"require 'org-install"

Hence there is a bug with `find-library' itself.  Let's wrap this in a
simple `condition-case'.
*** find-func.el.~1.83.~        Wed Oct 31 13:39:44 2007
--- find-func.el        Thu Jan 24 08:51:58 2008
***************
*** 195,205 ****
     (let* ((path (cons (or find-function-source-path load-path)
                      (find-library-suffixes)))
          (def (if (eq (function-called-at-point) 'require)
!                  (save-excursion
!                    (backward-up-list)
!                    (forward-char)
!                    (backward-sexp -2)
!                    (thing-at-point 'symbol))
                 (thing-at-point 'symbol))))
       (when def
         (setq def (and (locate-file-completion def path 'test) def)))
--- 195,207 ----
     (let* ((path (cons (or find-function-source-path load-path)
                      (find-library-suffixes)))
          (def (if (eq (function-called-at-point) 'require)
!                  (condition-case nil
!                      (save-excursion
!                        (backward-up-list)
!                        (forward-char)
!                        (backward-sexp -2)
!                        (thing-at-point 'symbol))
!                    (error nil))
                 (thing-at-point 'symbol))))
       (when def
         (setq def (and (locate-file-completion def path 'test) def)))

reply via email to

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