branch: externals/objed
commit bb5d097ee6c98cf13117abeffe757f2a25da0e76
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
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