]> code.delx.au - gnu-emacs/blobdiff - lisp/speedbar.el
Merge from emacs-23
[gnu-emacs] / lisp / speedbar.el
index d46dba39e854b94e48755b82d8239f0ca4c8bfa5..7413f73ee5077cfe53b5e3692afd7996b00d7f04 100644 (file)
@@ -1472,7 +1472,7 @@ File style information is displayed with `speedbar-item-info'."
     (if (looking-at "\\s-*[[<({].[]>)}] ") (goto-char (match-end 0)))
     ;; Get the text
     (speedbar-message "Text: %s" (buffer-substring-no-properties
-                                 (point) (progn (end-of-line) (point))))))
+                                 (point) (line-end-position)))))
 
 (defun speedbar-item-info ()
   "Display info in the minibuffer about the button the mouse is over.
@@ -1498,8 +1498,7 @@ instead of reading it from the speedbar buffer."
 Return nil if not applicable."
   (save-excursion
     (beginning-of-line)
-    (if (re-search-forward " [-+=]?> \\([^\n]+\\)"
-                          (save-excursion(end-of-line)(point)) t)
+    (if (re-search-forward " [-+=]?> \\([^\n]+\\)" (line-end-position) t)
        (let* ((tag (match-string 1))
              (attr (speedbar-line-token))
              (item nil)
@@ -1517,8 +1516,7 @@ Return nil if not applicable."
            (looking-at "\\([0-9]+\\):")
            (setq item (file-name-nondirectory (speedbar-line-directory)))
            (speedbar-message "Tag: %s  in %s" tag item)))
-      (if (re-search-forward "{[+-]} \\([^\n]+\\)$"
-                            (save-excursion(end-of-line)(point)) t)
+      (if (re-search-forward "{[+-]} \\([^\n]+\\)$" (line-end-position) t)
          (speedbar-message "Group of tags \"%s\"" (match-string 1))
        (if (re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t)
            (let* ((detailtext (match-string 1))
@@ -1645,8 +1643,8 @@ Files can be renamed to new names or moved to new directories."
     (if (speedbar-y-or-n-p (format "Delete %s? " f) t)
        (progn
          (if (file-directory-p f)
-             (delete-directory f)
-           (delete-file f))
+             (delete-directory f t t)
+           (delete-file f t))
          (speedbar-message "Okie dokie.")
          (let ((p (point)))
            (speedbar-refresh)
@@ -2061,8 +2059,7 @@ position to insert a new item, and that the new item will end with a CR."
   "Change the expansion button character to CHAR for the current line."
   (save-excursion
     (beginning-of-line)
-    (if (re-search-forward ":\\s-*.\\([-+?]\\)" (save-excursion (end-of-line)
-                                                               (point)) t)
+    (if (re-search-forward ":\\s-*.\\([-+?]\\)" (line-end-position) t)
        (speedbar-with-writable
          (goto-char (match-end 1))
          (insert-char char 1 t)
@@ -2851,9 +2848,7 @@ indicator, then do not add a space."
   (speedbar-with-writable
     (save-excursion
       (if (and replace-this
-              (re-search-forward replace-this (save-excursion (end-of-line)
-                                                              (point))
-                                 t))
+              (re-search-forward replace-this (line-end-position) t))
          (delete-region (match-beginning 0) (match-end 0))))
     (end-of-line)
     (if (not (string= " " indicator-string))
@@ -2951,9 +2946,7 @@ the file being checked."
         (fn (buffer-substring-no-properties
              ;; Skip-chars: thanks ptype@dra.hmg.gb
              (point) (progn
-                       (skip-chars-forward "^ "
-                                           (save-excursion (end-of-line)
-                                                           (point)))
+                       (skip-chars-forward "^ " (line-end-position))
                        (point))))
         (fulln (concat f fn)))
     (if (<= 2 speedbar-verbosity-level)
@@ -3025,9 +3018,7 @@ the file being checked."
         (fn (buffer-substring-no-properties
              ;; Skip-chars: thanks ptype@dra.hmg.gb
              (point) (progn
-                       (skip-chars-forward "^ "
-                                           (save-excursion (end-of-line)
-                                                           (point)))
+                       (skip-chars-forward "^ " (line-end-position))
                        (point))))
         (fulln (concat f fn)))
     (if (<= 2 speedbar-verbosity-level)
@@ -3248,7 +3239,7 @@ directory with these items."
        ;; If this fails, then it is a non-standard click, and as such,
        ;; perfectly allowed.
        (if (re-search-forward "[]>?}] [^ ]"
-                              (save-excursion (end-of-line) (point))
+                              (line-end-position)
                               t)
            (progn
              (forward-char -1)
@@ -3266,7 +3257,7 @@ With universal argument ARG, flush cached data."
     (condition-case nil
        (progn
          (re-search-forward ":\\s-*.\\+. "
-                            (save-excursion (end-of-line) (point)))
+                            (line-end-position))
          (forward-char -2)
          (speedbar-do-function-pointer))
       (error (speedbar-position-cursor-on-line)))))
@@ -3283,7 +3274,7 @@ With universal argument ARG, flush cached data."
   (condition-case nil
       (progn
        (re-search-forward ":\\s-*.-. "
-                          (save-excursion (end-of-line) (point)))
+                          (line-end-position))
        (forward-char -2)
        (speedbar-do-function-pointer))
     (error (speedbar-position-cursor-on-line))))
@@ -3295,7 +3286,7 @@ With universal argument ARG, flush cached data."
   (condition-case nil
       (progn
        (re-search-forward ":\\s-*.[-+]. "
-                          (save-excursion (end-of-line) (point)))
+                          (line-end-position))
        (forward-char -2)
        (speedbar-do-function-pointer))
     (error (speedbar-position-cursor-on-line))))
@@ -3763,17 +3754,12 @@ The line should contain output from etags.  Parse the output using the
 regular expression EXPR."
   (let* ((sym (if (stringp expr)
                  (if (save-excursion
-                       (re-search-forward expr (save-excursion
-                                                 (end-of-line)
-                                                 (point)) t))
+                       (re-search-forward expr (line-end-position) t))
                      (buffer-substring-no-properties (match-beginning 1)
                                                      (match-end 1)))
                (funcall expr)))
         (pos (let ((j (re-search-forward "[\C-?\C-a]\\([0-9]+\\),\\([0-9]+\\)"
-                                         (save-excursion
-                                           (end-of-line)
-                                           (point))
-                                         t)))
+                                         (line-end-position) t)))
                (if (and j sym)
                    (1+ (string-to-number (buffer-substring-no-properties
                                        (match-beginning 2)
@@ -3786,7 +3772,7 @@ regular expression EXPR."
 (defun speedbar-parse-c-or-c++tag ()
   "Parse a C or C++ tag, which tends to be a little complex."
   (save-excursion
-    (let ((bound (save-excursion (end-of-line) (point))))
+    (let ((bound (line-end-position)))
       (cond ((re-search-forward "\C-?\\([^\C-a]+\\)\C-a" bound t)
             (buffer-substring-no-properties (match-beginning 1)
                                             (match-end 1)))
@@ -3802,7 +3788,7 @@ regular expression EXPR."
 (defun speedbar-parse-tex-string ()
   "Parse a Tex string.  Only find data which is relevant."
   (save-excursion
-    (let ((bound (save-excursion (end-of-line) (point))))
+    (let ((bound (line-end-position)))
       (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t)
             (buffer-substring-no-properties (match-beginning 0)
                                             (match-end 0)))
@@ -3947,9 +3933,7 @@ Optional argument DEPTH specifies the current depth of the back search."
        (let* ((bn (speedbar-line-text))
               (buffer (if bn (get-buffer bn))))
          (if buffer
-             (if (save-excursion
-                   (end-of-line)
-                   (eq start (point)))
+             (if (eq start (line-end-position))
                  (or (with-current-buffer buffer default-directory)
                      "")
                (buffer-file-name buffer))))))))
@@ -3981,14 +3965,10 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
     (beginning-of-line)
     ;; If this fails, then it is a non-standard click, and as such,
     ;; perfectly allowed
-    (if (re-search-forward "[]>?}] [^ ]"
-                          (save-excursion (end-of-line) (point))
-                          t)
+    (if (re-search-forward "[]>?}] [^ ]" (line-end-position) t)
        (let ((text (progn
                      (forward-char -1)
-                     (buffer-substring (point) (save-excursion
-                                                 (end-of-line)
-                                                 (point))))))
+                     (buffer-substring (point) (line-end-position)))))
          (if (get-buffer text)
              (progn
                (set-buffer text)
@@ -4004,14 +3984,11 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
   "Highlight the current line, unhighlighting a previously jumped to line."
   (speedbar-unhighlight-one-tag-line)
   (setq speedbar-highlight-one-tag-line
-       (speedbar-make-overlay (save-excursion (beginning-of-line) (point))
-                              (save-excursion (end-of-line)
-                                              (forward-char 1)
-                                              (point))))
+       (speedbar-make-overlay (line-beginning-position)
+                              (1+ (line-end-position))))
   (speedbar-overlay-put speedbar-highlight-one-tag-line 'face
                        'speedbar-highlight-face)
-  (add-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line)
-  )
+  (add-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line))
 
 (defun speedbar-unhighlight-one-tag-line ()
   "Unhighlight the currently highlighted line."