emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: list-at-point


From: Andreas Roehler
Subject: Re: list-at-point
Date: Thu, 26 Oct 2006 07:46:17 +0200
User-agent: Thunderbird 1.5.0.4 (X11/20060516)


 What do you do if scan-lists reports an error?



Condition case re-introduced...

It now reads as follows:


(defun bounds-of-thatpt (thing &optional arg)
 "
 Determine the start and end buffer locations for the THING at point.
 THING is a symbol which specifies the kind of syntactic entity you want.
Possibilities include `symbol', `list', `sexp', `defun', `filename', `url',
 `word', `sentence', `whitespace', `line', `page' and others."
 (condition-case nil
     (save-excursion
     (let ((orig (point))
            (beg (progn
               (funcall ;; First, move to beg.
                (or (get thing 'beginning-op)
                (lambda ()
                  (forward-char 1)
                  (forward-thing thing -1))))
               (point)))
            (end
             (progn  (funcall ;; Then move to end.
              (or (get thing 'end-op)
              (lambda () (forward-thing thing 1))))
                (point))))
       ;; if orig not between beg and end, failure, nil
       (when (and(<= beg orig) (<= orig end) (< beg end))
         (cons beg end))))
   (error nil)))


Please have a look at the newly published thingatpt-util.el at gnu.emacs.sources


Thanks

__
Andreas Roehler





reply via email to

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