Changeset 36 for lang

Show
Ignore:
Timestamp:
04/28/08 14:42:51 (17 years ago)
Author:
tsuyoshi
Message:

Fix username-pos invalid integer-or-marker-p problem.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/elisp/twittering-mode/branches/tsuyoshi/twittering-mode.el

    r34 r36  
    959959      (while (and pos (not (eq prop twittering-username-face))) 
    960960        (setq pos (next-single-property-change pos 'face)) 
    961         (when (eq pos nil) (throw 'not-found 0)) 
    962         (setq prop (get-text-property pos 'face)))) 
    963     pos)) 
     961        (when (eq pos nil) (throw 'not-found nil)) 
     962        (setq prop (get-text-property pos 'face))) 
     963      pos))) 
    964964 
    965965(defun twittering-goto-previous-status () 
     
    978978      (while (and pos (not (eq prop twittering-username-face))) 
    979979        (setq pos (previous-single-property-change pos 'face)) 
    980         (when (eq pos nil) (throw 'not-found 0)) 
    981         (setq prop (get-text-property pos 'face)))) 
    982     pos)) 
     980        (when (eq pos nil) (throw 'not-found nil)) 
     981        (setq prop (get-text-property pos 'face))) 
     982      pos))) 
    983983 
    984984(defun twittering-goto-next-status-of-user () 
     
    987987  (let ((user-name (twittering-get-username-at-pos (point))) 
    988988        (pos (twittering-get-next-username-face-pos (point)))) 
    989     (catch 'not-found 
    990       (while (not (equal (twittering-get-username-at-pos pos) user-name)) 
    991         (setq pos (twittering-get-next-username-face-pos pos)) 
    992         (when (eq pos nil) (throw 'not-found 0)))) 
     989    (while (and (not (eq pos nil)) 
     990                (not (equal (twittering-get-username-at-pos pos) user-name))) 
     991      (setq pos (twittering-get-next-username-face-pos pos))) 
    993992    (if pos 
    994993        (goto-char pos) 
    995       (message "End of %s's status." user-name)))) 
     994      (if user-name 
     995          (message "End of %s's status." user-name) 
     996        (message "Invalid user-name."))))) 
    996997 
    997998(defun twittering-goto-previous-status-of-user () 
     
    10001001  (let ((user-name (twittering-get-username-at-pos (point))) 
    10011002        (pos (twittering-get-previous-username-face-pos (point)))) 
    1002     (catch 'not-found 
    1003       (while (not (equal (twittering-get-username-at-pos pos) user-name)) 
    1004         (setq pos (twittering-get-previous-username-face-pos pos)) 
    1005         (when (eq pos nil) (throw 'not-found 0)))) 
     1003    (while (and (not (eq pos nil)) 
     1004                (not (equal (twittering-get-username-at-pos pos) user-name))) 
     1005      (setq pos (twittering-get-previous-username-face-pos pos))) 
    10061006    (if pos 
    10071007        (goto-char pos) 
    1008       (message "Start of %s's status." user-name)))) 
     1008      (if user-name 
     1009          (message "Start of %s's status." user-name) 
     1010        (message "Invalid user-name."))))) 
    10091011 
    10101012(defun twittering-get-username-at-pos (pos) 
    10111013  (let ((start-pos pos) 
    10121014        (end-pos)) 
    1013     (while (eq (get-text-property start-pos 'face) twittering-username-face) 
    1014       (setq start-pos (1- start-pos))) 
    1015     (setq start-pos (1+ start-pos)) 
    1016     (setq end-pos (next-single-property-change pos 'face)) 
    1017     (buffer-substring start-pos end-pos))) 
     1015    (catch 'not-found 
     1016      (while (eq (get-text-property start-pos 'face) twittering-username-face) 
     1017        (setq start-pos (1- start-pos)) 
     1018        (when (or (eq start-pos nil) (eq start-pos 0)) (throw 'not-found nil))) 
     1019      (setq start-pos (1+ start-pos)) 
     1020      (setq end-pos (next-single-property-change pos 'face)) 
     1021      (buffer-substring start-pos end-pos)))) 
    10181022 
    10191023;;;###autoload