emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/objed bb5d097 11/21: Improve file object


From: Clemens Radermacher
Subject: [elpa] externals/objed bb5d097 11/21: Improve file object
Date: Sun, 17 Mar 2019 15:00:17 -0400 (EDT)

branch: externals/objed
commit bb5d097ee6c98cf13117abeffe757f2a25da0e76
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>

    Improve file object
---
 objed-objects.el | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/objed-objects.el b/objed-objects.el
index 66ee922..6c5a6f0 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -1605,15 +1605,27 @@ comments."
   :atp
   (looking-at "/\\|\\\\")
   :get-obj
-  ;; TODO: inner bounds without extension
   (let* ((bounds (bounds-of-thing-at-point 'filename))
          (file (and bounds (buffer-substring (car bounds) (cdr bounds)))))
-    (when (and file (string-match "/\\|\\\\" file))
-      bounds))
+    (when (and file (string-match (rx (or (and bos (or "/" "\\"))
+                                          (and "." (* alnum) eos)))
+                                  file))
+      (objed-make-object :obounds bounds
+                         :ibounds
+                         (let ((ifile (or (file-name-directory file)
+                                          (file-name-sans-extension file))))
+                           (when ifile
+                             (goto-char (car bounds))
+                             (search-forward ifile)
+                             (cons (match-beginning 0) (match-end 0)))))))
   :try-next
-  (re-search-forward  "/\\|\\\\" nil t)
+  (re-search-forward  (rx (or (or "/" "\\")
+                              (and "." (* alnum))))
+                      nil t)
   :try-prev
-  (re-search-backward  "/\\|\\\\" nil t))
+  (re-search-backward  (rx (or (or "/" "\\")
+                               (and "." (* alnum))))
+                       nil t))
 
 (objed-define-object nil mail
   :get-obj



reply via email to

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