emacs-devel
[Top][All Lists]
Advanced

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

Re: function-called-at-point: ignore-errors around find-tag-default


From: Stefan Monnier
Subject: Re: function-called-at-point: ignore-errors around find-tag-default
Date: Thu, 17 Feb 2005 08:14:45 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> --- /usr/local/stow/emacs-cvs/share/emacs/22.0.50/lisp/.backup/subr.el.~1~    
> 2005-02-09 07:50:41.000000000 -0800
> +++ /usr/local/stow/emacs-cvs/share/emacs/22.0.50/lisp/subr.el        
> 2005-02-16 19:50:57.000000000 -0800
> @@ -1969,13 +1969,15 @@
>           (re-search-forward "\\(\\sw\\|\\s_\\)+"
>                              (save-excursion (end-of-line) (point))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                               (line-end-position)

>                              t))
> -     (progn (goto-char (match-end 0))
> -            (buffer-substring-no-properties
> -                (point)
> -                (progn (forward-sexp -1)
> -                       (while (looking-at "\\s'")
> -                         (forward-char 1))
> -                       (point))))
> +     (condition-case nil
> +            (progn (goto-char (match-end 0))
> +                   (buffer-substring-no-properties
> +                    (point)
> +                    (progn (forward-sexp -1)
> +                           (while (looking-at "\\s'")
> +                             (forward-char 1))
> +                           (point))))
> +          (error nil))
>        nil)))
 
I recommend to only catch "scan-error" so as not to hide other potential
bugs.  But maybe a better fix is to let-bind forward-sexp-function to nil
around the call to forward-sexp.  After all, we're using here forward-sexp
to skip over a symbol, not just any a sexp.  Or maybe even replace
forward-sexp with (skip-syntax-backward "w_"), although it seems so obvious
that maybe there's a reason why it's not done: better check the file's log
to seen if it wasn't (skip-syntax-backward "w_") already in the past.


        Stefan




reply via email to

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