-
-
Notifications
You must be signed in to change notification settings - Fork 85
Better integration with dired-details invisible properties
#139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
20a2344
efbd12d
7f078e4
04b32c2
7db803a
138bb04
12c886a
f482c90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,43 @@ | |
| :group 'dired | ||
| :prefix "dired-hacks-") | ||
|
|
||
| (defun dired-utils-fillin-invisible-property (beg end symbol) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two functions look generic enough (if we also pass the property name as arg) to be included in some other package (s.el?). We can leave them here for now but I know I've written similar code before. They would be quite useful in Emacs itself as well.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I got the idea from |
||
| "Put SYMBOL as the invisible text property for the region between BEG and END. | ||
|
|
||
| Respect the current value of the invisible property for text in | ||
| the region." | ||
| (let ((next (next-single-property-change beg 'invisible nil end)) | ||
| (invis nil)) | ||
| (while (/= beg end) | ||
| (setq invis (get-text-property beg 'invisible)) | ||
| (cond | ||
| ((null invis) | ||
| (put-text-property beg next 'invisible symbol)) | ||
| ((and (symbolp invis) (not (eq invis symbol))) | ||
| (put-text-property beg next 'invisible (list invis symbol))) | ||
| ((and (listp invis) (not (memq symbol invis))) | ||
| (put-text-property beg next 'invisible (cons symbol invis)))) | ||
| (setq beg next | ||
| next (next-single-property-change beg 'invisible nil end))))) | ||
|
|
||
| (defun dired-utils-remove-invisible-property (beg end symbol) | ||
| "Remove SYMBOL from the invisible property for the region between BEG and END. | ||
|
|
||
| Respect the value of the invisible property for text in the | ||
| region." | ||
| (let ((next (next-single-property-change beg 'invisible nil end)) | ||
| (invis nil)) | ||
| (while (/= beg end) | ||
| (setq invis (get-text-property beg 'invisible)) | ||
| (cond | ||
| ((null invis)) | ||
| ((and (symbolp invis) (eq invis symbol)) | ||
| (put-text-property beg next 'invisible nil)) | ||
| ((listp invis) | ||
| (put-text-property beg next 'invisible (delq symbol invis)))) | ||
| (setq beg next | ||
| next (next-single-property-change beg 'invisible nil end))))) | ||
|
|
||
| (defun dired-utils-get-filename (&optional localp) | ||
| "Like `dired-get-filename' but never signal an error. | ||
|
|
||
|
|
@@ -161,7 +198,7 @@ line." | |
| (--dotimes arg | ||
| (forward-line) | ||
| (while (and (or (not (dired-utils-is-file-p)) | ||
| (get-text-property (point) 'invisible)) | ||
| (invisible-p (point))) | ||
| (= (forward-line) 0)))) | ||
| (if (not (= (point) (point-max))) | ||
| (dired-move-to-filename) | ||
|
|
@@ -181,7 +218,7 @@ line." | |
| (--dotimes arg | ||
| (forward-line -1) | ||
| (while (and (or (not (dired-utils-is-file-p)) | ||
| (get-text-property (point) 'invisible)) | ||
| (invisible-p (point))) | ||
| (= (forward-line -1) 0)))) | ||
| (if (not (= (point) (point-min))) | ||
| (dired-move-to-filename) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice that you got rid of this!