* find-file-dwim.el @ 2024-07-21 22:10 Emanuel Berg 2024-07-22 3:33 ` find-file-dwim.el Emanuel Berg 2024-07-22 5:32 ` find-file-dwim.el Emanuel Berg 0 siblings, 2 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-21 22:10 UTC (permalink / raw) To: emacs-devel I'll do the legendary Holy Grail of Elisp programming, namely find-file-dwim.el - I don't think you have that, eh? And no doubt it belongs in ELPA. For the record, this idea is not mine originally. If anyone wants to join, please do. I have a plan how to do it, as always. Some people are not allowed to join - and it is too difficult for them anyway - so it is all good they also don't comment on anything thus saving themself the embarrassment of further ruining their reputations. No more Mr Nice Guy from me explaining things, but know, take a cheap shot without massive backup that is very, very convincing and what will happen you can prepare 20x the amount back, instantly. I have absolutely nothing to prove to a bunch of of flamers and lamers. OK, how will I do it? Join, you get whatever position or task you want, and I'll tell you :) Join by sending mail, we don't take it here if possible. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-21 22:10 find-file-dwim.el Emanuel Berg @ 2024-07-22 3:33 ` Emanuel Berg 2024-07-22 14:02 ` find-file-dwim.el Philip Kaludercic 2024-07-22 5:32 ` find-file-dwim.el Emanuel Berg 1 sibling, 1 reply; 12+ messages in thread From: Emanuel Berg @ 2024-07-22 3:33 UTC (permalink / raw) To: emacs-devel > I'll do the legendary Holy Grail of Elisp programming, > namely find-file-dwim.el I'm working on this now so I'll forget all the rest. Do Calc if you want to. This will be a heck of an application. There will be several servers that are always ready and as soon as one server gets it right it will be promoted to try its thing sooner the next time. The individual servers can also be adapting and self-improving just by functioning much like a memory hierarchy with levels of differently sized, paced, and priced cache. Maybe overkill to do but would be cool. But it is all based on proximity in time and space. Ikr? Just like a drill! -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-22 3:33 ` find-file-dwim.el Emanuel Berg @ 2024-07-22 14:02 ` Philip Kaludercic 2024-07-22 15:40 ` find-file-dwim.el Emanuel Berg 2024-07-23 0:47 ` find-file-dwim.el Emanuel Berg 0 siblings, 2 replies; 12+ messages in thread From: Philip Kaludercic @ 2024-07-22 14:02 UTC (permalink / raw) To: emacs-devel It might just be, but your message confuses me: I am not sure what you are trying to say here, are you proposing adding the these functions to the core (in which case a patch would be more appropriate) or to ELPA (in which case we'd like a link to some Git repository). If you are just interested in sharing code with others, perhaps the development mailing list is not the right place to do so. (Also, please don't forget to CC me in your response, I recall this being an issue in the past where I didn't see your response until much later). Emanuel Berg <incal@dataswamp.org> writes: >> I'll do the legendary Holy Grail of Elisp programming, >> namely find-file-dwim.el > > I'm working on this now so I'll forget all the rest. Do Calc if > you want to. > > This will be a heck of an application. There will be several > servers that are always ready and as soon as one server gets > it right it will be promoted to try its thing sooner the > next time. > > The individual servers can also be adapting and self-improving > just by functioning much like a memory hierarchy with levels > of differently sized, paced, and priced cache. Maybe overkill > to do but would be cool. > > But it is all based on proximity in time and space. > > Ikr? Just like a drill! Emanuel Berg <incal@dataswamp.org> writes: >> I'll do the legendary Holy Grail of Elisp programming, >> namely find-file-dwim.el > > Four methods now and one can add a lot of those if one comes up > with new ideas. > > What remains to do, well, polishing, is the interface and > I think it will be super-important to get that right, how to > indicate a suggested file isn't what you look for, for > example. > > I'll post a new version in a couple of days or so, maybe. > > ;;; -*- lexical-binding: t -*- > ;; > ;; this file: > ;; https://dataswamp.org/~incal/emacs-init/find-file-dwim.el > ;; > ;; created: 2024-07-22 > ;; version: 0.1.0 > > (require 'cl-lib) > (require 'psea) ; https://dataswamp.org/~incal/emacs-init/psea.el > > (defun buffers () > (mapcar #'buffer-name (buffer-list)) ) > > ;; (buffers) > > (defun mod-time-sec (f) > (let ((s (time-convert > (file-attribute-modification-time (file-attributes f)) > 'integer) )) > (list s f) )) > > ;; (mod-time-sec "~/.emacs") > > (defun remove-data (ds) > (mapcar #'cadr ds) ) > > (defun sort-mod-time-sec (&optional dir) > (or dir (setq dir default-directory)) > (let ((fs (directory-files dir nil nil t))) > (remove-data > (reverse (cl-sort (mapcar #'mod-time-sec fs) #'> :key #'car)) ))) > > ;; (sort-mod-time-sec) > > (defun psea-hit (s fs &optional max gov) > (and max (setq fs (seq-take fs max))) > (or gov (setq gov 70) ) > (cl-loop > with perc > with res > for f in fs do > (setq perc (sdp s f)) > (when (< gov perc) > (cl-pushnew (list perc f) res) ) > finally return (remove-data (cl-sort res #'> :key #'car)) )) > > ;; (psea-hit "buffer-menu" (buffers)) > ;; (psea-hit "find-file-dwim.el" (sort-mod-time-sec)) > > (defun re-hit (re fs &optional max) > (and max (setq fs (seq-take fs max))) > (cl-remove-if-not (lambda (f) (string-match re f)) fs) ) > > ;; (re-hit "line" (buffers)) > ;; (re-hit "line" (sort-mod-time-sec) 1000) > > (provide 'find-file-dwim) -- Philip Kaludercic on peregrine ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-22 14:02 ` find-file-dwim.el Philip Kaludercic @ 2024-07-22 15:40 ` Emanuel Berg 2024-07-23 0:47 ` find-file-dwim.el Emanuel Berg 1 sibling, 0 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-22 15:40 UTC (permalink / raw) To: emacs-devel; +Cc: Philip Kaludercic Philip Kaludercic wrote: > It might just be, but your message confuses me: I am not > sure what you are trying to say here, are you proposing > adding the these functions to the core (in which case > a patch would be more appropriate) or to ELPA (in which case > we'd like a link to some Git repository). Well, I'll return to this when it is functioning, so you (and everyone) can try it and it will be easy to explain what its purpose is. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-22 14:02 ` find-file-dwim.el Philip Kaludercic 2024-07-22 15:40 ` find-file-dwim.el Emanuel Berg @ 2024-07-23 0:47 ` Emanuel Berg 2024-07-23 6:41 ` find-file-dwim.el Philip Kaludercic 2024-07-23 7:06 ` find-file-dwim.el Michael Albinus 1 sibling, 2 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-23 0:47 UTC (permalink / raw) To: emacs-devel; +Cc: Philip Kaludercic Philip Kaludercic wrote: > It might just be, but your message confuses me: I am not > sure what you are trying to say here, are you proposing > adding the these functions to the core (in which case > a patch would be more appropriate) or to ELPA (in which case > we'd like a link to some Git repository). If you are just > interested in sharing code with others, perhaps the > development mailing list is not the right place to do so. > (Also, please don't forget to CC me in your response, > I recall this being an issue in the past where I didn't see > your response until much later). Suggestion: The next time you or anyone else gets confused by my actions, instead of theorizing several different scenarios and criticizing each one in turn on a public ML, either send me a private mail where you just ask - or, even better, accept that you cannot understand every other human being on the planet - instead, focus on whatever it is _you_ are doing, I think will be a lot less confusing simple as it may sound. What I am doing? I am doing an alternative to `find-file', called `find-file-dwim'. As of now, some building blocks are in place, you can check out version 0.3.2 here - but it needs much more time and possibly some additional big things to be added, as well. https://dataswamp.org/~incal/emacs-init/find-file-dwim.el -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-23 0:47 ` find-file-dwim.el Emanuel Berg @ 2024-07-23 6:41 ` Philip Kaludercic [not found] ` <87jzhcqw4a.fsf@dataswamp.org> 2024-07-23 13:01 ` find-file-dwim.el Emanuel Berg 2024-07-23 7:06 ` find-file-dwim.el Michael Albinus 1 sibling, 2 replies; 12+ messages in thread From: Philip Kaludercic @ 2024-07-23 6:41 UTC (permalink / raw) To: Emanuel Berg; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 2056 bytes --] Emanuel Berg <incal@dataswamp.org> writes: > The following message is a courtesy copy of an article > that has been posted to gmane.emacs.devel as well. > > Philip Kaludercic wrote: > >> It might just be, but your message confuses me: I am not ^ *me >> sure what you are trying to say here, are you proposing >> adding the these functions to the core (in which case >> a patch would be more appropriate) or to ELPA (in which case >> we'd like a link to some Git repository). If you are just >> interested in sharing code with others, perhaps the >> development mailing list is not the right place to do so. >> (Also, please don't forget to CC me in your response, >> I recall this being an issue in the past where I didn't see >> your response until much later). > > Suggestion: The next time you or anyone else gets confused by > my actions, instead of theorizing several different scenarios > and criticizing each one in turn on a public ML, either send > me a private mail where you just ask - or, even better, accept > that you cannot understand every other human being on the > planet - instead, focus on whatever it is _you_ are doing, > I think will be a lot less confusing simple as it may sound. My apologies if I offended you, it certainly wasn't my intention. My "job" is just to review ELPA submissions, and I wanted to check if your message was a proposal to add a package or not. > What I am doing? I am doing an alternative to `find-file', > called `find-file-dwim'. That is clear, my question was with what intention are you posting your code on the development mailing list: (a) To add the code to ELPA, (b) To add the code to the Emacs core, (c) None of the above. Depending on which of these > As of now, some building blocks are in place, you can check > out version 0.3.2 here - but it needs much more time and > possibly some additional big things to be added, as well. > > https://dataswamp.org/~incal/emacs-init/find-file-dwim.el Here are a few comments and improvements, fwiw: [-- Attachment #2: Type: text/plain, Size: 5299 bytes --] diff -u /tmp/find-file-dwim-comments.el /tmp/find-file-dwim.el --- /tmp/find-file-dwim-comments.el 2024-07-23 08:33:36.412846100 +0200 +++ /tmp/find-file-dwim.el 2024-07-23 04:59:05.000000000 +0200 @@ -1,112 +1,72 @@ -;;; find-file-dwim.el --- A `find-file' alternative -*- lexical-binding: t; -*- - -;; Copyright (C) 2024 Philip Kaludercic - -;; Author: Emanuel Berg <incal@dataswamp.org> -;; Keywords: files -;; URL: https://dataswamp.org/~incal/emacs-init/find-file-dwim.el -;; Created: 2024-07-22 -;; Version: 0.3.1 - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <https://www.gnu.org/licenses/>. - -;;; Commentary: - -;; This package provides an alternative to `find-file'. (Perhaps -;; explain the difference betweeen `find-file-dwim' and -;; `find-file-at-point' or the future history of `find-file'). - -;;; Code: +;;; -*- lexical-binding: t -*- +;; +;; this file: +;; https://dataswamp.org/~incal/emacs-init/find-file-dwim.el +;; +;; created: 2024-07-22 +;; version: 0.3.1 (require 'cl-lib) (require 'psea) ; https://dataswamp.org/~incal/emacs-init/psea.el -(defvar ffd-coll (sort-mod-time-sec) - "***DOCUMENTATION MISSING HERE***") +(defvar ffd-coll) +(setq ffd-coll (sort-mod-time-sec)) -;;;###autoload (defun find-file-dwim (&optional f) - "***DOCUMENTATION MISSING HERE***" (interactive (list - ;; are you sure you want to evaluate `ffd-coll' at - ;; load time? `sort-mod-time-sec' takes an implicit - ;; argument (the current directory) that this function - ;; will operate on the same directory, no matter where - ;; it is invoked. I don't think that qualifies at - ;; DWIM... - (completing-read-default "File: " ffd-coll nil nil default-directory))) + (completing-read-default "File: " ffd-coll nil nil default-directory) )) (when (file-exists-p f) - (find-file f))) + (find-file f) )) -;; (defalias 'f #'find-file-dwim) please don't do this by default! +(defalias 'f #'find-file-dwim) -(defun buffers () ;this appears to be dead code - "***DOCUMENTATION MISSING HERE***" - (mapcar #'buffer-name (buffer-list))) +(defun buffers () + (mapcar #'buffer-name (buffer-list)) ) ;; (buffers) -(defun get-dirs (fs) ;this as well - "***DOCUMENTATION MISSING HERE***" +(defun get-dirs (fs) (let ((dirs (cl-remove-if-not #'file-directory-p fs))) - (cl-sort dirs #'string<))) ;`directory-files' sorts by default! + (cl-sort dirs #'string<) )) ;; (get-dirs (directory-files "." t)) -(defun remove-data (ds) ;please prefix functions for their namespace - "***DOCUMENTATION MISSING HERE***" - (mapcar #'cadr ds)) +(defun remove-data (ds) + (mapcar #'cadr ds) ) (defun mod-time-sec (f) - "***DOCUMENTATION MISSING HERE***" - (let* ((attribs (file-attribute-modification-time (file-attributes f))) - (s (time-convert attribs 'integer))) - (list s f))) + (let*((attribs (file-attribute-modification-time (file-attributes f))) + (s (time-convert attribs 'integer) )) + (list s f) )) ;; (mod-time-sec "~/.emacs") (defun sort-mod-time-sec (&optional dir) - "***DOCUMENTATION MISSING HERE***" - (unless dir - (setq dir default-directory)) - (let* ((fs (directory-files dir t nil t)) - (all (mapcar #'mod-time-sec fs))) - (cl-sort all #'> :key #'car))) + (or dir (setq dir default-directory)) + (let*((fs (directory-files dir t nil t)) + (all (mapcar #'mod-time-sec fs) )) + (cl-sort all #'> :key #'car) )) ;; (sort-mod-time-sec) -(defun psea-hit (s fs &optional gov) ;this is dead code and uses the prefix of your other library? - "***DOCUMENTATION MISSING HERE***" +(defun psea-hit (s fs &optional gov) (or gov (setq gov 70)) (cl-loop - with perc - with res - for f in fs do - (setq perc (sdp s f)) ;`cl-loop' has keywords for these operations! - (when (< gov perc) - (cl-pushnew (list perc f) res)) - finally return (remove-data (cl-sort res #'> :key #'car)))) + with perc + with res + for f in fs do + (setq perc (sdp s f)) + (when (< gov perc) + (cl-pushnew (list perc f) res) ) + finally return (remove-data (cl-sort res #'> :key #'car)) )) ;; (psea-hit "buffer-menu" (buffers)) ;; (psea-hit "find-file-dwim.el" (remove-data (sort-mod-time-sec))) -(defun re-hit (re fs) ;nobody calls this, is this part of the library interface? - "***DOCUMENTATION MISSING HERE***" - (cl-remove-if-not (lambda (f) (string-match re f)) fs)) +(defun re-hit (re fs) + (cl-remove-if-not (lambda (f) (string-match re f)) fs) ) ;; (re-hit "line" (buffers)) ;; (re-hit "line" (remove-data (sort-mod-time-sec))) (provide 'find-file-dwim) -;;; find-file-dwim.el ends here Diff finished. Tue Jul 23 08:33:58 2024 [-- Attachment #3: Type: text/plain, Size: 37 bytes --] -- Philip Kaludercic on peregrine ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <87jzhcqw4a.fsf@dataswamp.org>]
* Re: find-file-dwim.el [not found] ` <87jzhcqw4a.fsf@dataswamp.org> @ 2024-07-23 10:20 ` Philip Kaludercic 2024-07-23 13:08 ` find-file-dwim.el Emanuel Berg 0 siblings, 1 reply; 12+ messages in thread From: Philip Kaludercic @ 2024-07-23 10:20 UTC (permalink / raw) To: Emanuel Berg; +Cc: emacs-devel (You are still dropping emacs-devel from the CC) Emanuel Berg <incal@dataswamp.org> writes: > Philip Kaludercic wrote: > >> My apologies if I offended you, it certainly wasn't my >> intention. > > Really? But if so, it is alright then. > >> My "job" is just to review ELPA submissions, and I wanted to >> check if your message was a proposal to add a package >> or not. > > Of course not at this point, not even being anywhere close to > the form required by ELPA? > >> That is clear, my question was with what intention are you >> posting your code on the development mailing list: >> >> (a) To add the code to ELPA, >> (b) To add the code to the Emacs core, >> (c) None of the above. > > Well, it is not up to me where it will be added, so I focus > now on completing it. Then testing and if it is an > improvement, we take it from there. That is what confused me. Usually people don't share prototypes this early with the mailing list. But of course it is also up to you where you'd like to have this kind of a feature added, as soon as it is mature enough. But as mentioned in my comments, you should clarify what the "DWIM" aspect of your script is. Find-file already has some DWIM-ish stuff going on with the "future history" (M-n), so I am guessing your plan is to do something different? >> Here are a few comments and improvements, fwiw: > > Thanks, all is good then. -- Philip Kaludercic on peregrine ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-23 10:20 ` find-file-dwim.el Philip Kaludercic @ 2024-07-23 13:08 ` Emanuel Berg 0 siblings, 0 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-23 13:08 UTC (permalink / raw) To: emacs-devel Philip Kaludercic wrote: > That is what confused me. Usually people don't share > prototypes this early with the mailing list. It is amazing to behold: not everyone does everything the same way. > But of course it is also up to you where you'd like to have > this kind of a feature added, as soon as it is > mature enough. It must also be tested to see if it really is an improvement before any of that can be contemplated. > But as mentioned in my comments, you should clarify what the > "DWIM" aspect of your script is. Find-file already has some > DWIM-ish stuff going on with the "future history" (M-n), so > I am guessing your plan is to do something different? I have several ideas and they are not opposed to each other so maybe I'll do all of them. The most simplest idea is based on the COLLECTION which will be updated on the fly and limited to a smaller scope. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-23 6:41 ` find-file-dwim.el Philip Kaludercic [not found] ` <87jzhcqw4a.fsf@dataswamp.org> @ 2024-07-23 13:01 ` Emanuel Berg 1 sibling, 0 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-23 13:01 UTC (permalink / raw) To: emacs-devel Philip Kaludercic wrote: > My apologies if I offended you, it certainly wasn't my > intention. Okay then, if you say. > My "job" is just to review ELPA submissions, and I wanted to > check if your message was a proposal to add a package > or not. Okay, no, as is, again, evident from the state of that file including its formatting it isn't a suggestion for ELPA at this point by far. But thanks for the suggestions to the Elisp and I did some that. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-23 0:47 ` find-file-dwim.el Emanuel Berg 2024-07-23 6:41 ` find-file-dwim.el Philip Kaludercic @ 2024-07-23 7:06 ` Michael Albinus 2024-07-25 9:24 ` find-file-dwim.el Emanuel Berg 1 sibling, 1 reply; 12+ messages in thread From: Michael Albinus @ 2024-07-23 7:06 UTC (permalink / raw) To: emacs-devel Emanuel Berg <incal@dataswamp.org> writes: Hi Emanuel, > Suggestion: The next time you or anyone else gets confused by > my actions, instead of theorizing several different scenarios > and criticizing each one in turn on a public ML, either send > me a private mail where you just ask - or, even better, accept > that you cannot understand every other human being on the > planet - instead, focus on whatever it is _you_ are doing, > I think will be a lot less confusing simple as it may sound. If you are saying something on a public ML, be prepared people respond. Or be quiet. Best regards, Michael. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-23 7:06 ` find-file-dwim.el Michael Albinus @ 2024-07-25 9:24 ` Emanuel Berg 0 siblings, 0 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-25 9:24 UTC (permalink / raw) To: emacs-devel Michael Albinus wrote: > If you are saying something on a public ML, be prepared > people respond. Or be quiet. The socialization process is in full swing. Suggestion: Apply the rules to everyone equally, or what will happen is everyone will start to behave like that. Anyway, this whole idea - make the collection smaller, by recomputing it - I realized, if you gonna do that, why not do it every time? Like below, instead of `minibuffer-complete'. Maybe I misunderstood the idea? I'm over discussing things on this list, but use e-mail by all means if this is something you would like to discuss. ;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/minibuffer-complete-files.el ;; ;; (keymap-global-set "M-8" #'minibuffer-complete-files) (require 'cl-lib) (defun string-to-dir (s) (if (file-directory-p s) s (let ((new (replace-regexp-in-string "\\(.*/\\).*$" "\\1" s))) (when (file-directory-p new) new) ))) (defun minibuffer-complete-files () (interactive) (let* ((beg (minibuffer-prompt-end)) (end (point-max)) (str (buffer-substring-no-properties beg end)) (dir (string-to-dir str)) (col (when dir (directory-files dir t))) (abr (mapcar #'abbreviate-file-name col)) (all (cl-union col abr)) ) (when all (completion-in-region (minibuffer--completion-prompt-end) end all) ))) (provide 'minibuffer-complete-files) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: find-file-dwim.el 2024-07-21 22:10 find-file-dwim.el Emanuel Berg 2024-07-22 3:33 ` find-file-dwim.el Emanuel Berg @ 2024-07-22 5:32 ` Emanuel Berg 1 sibling, 0 replies; 12+ messages in thread From: Emanuel Berg @ 2024-07-22 5:32 UTC (permalink / raw) To: emacs-devel > I'll do the legendary Holy Grail of Elisp programming, > namely find-file-dwim.el Four methods now and one can add a lot of those if one comes up with new ideas. What remains to do, well, polishing, is the interface and I think it will be super-important to get that right, how to indicate a suggested file isn't what you look for, for example. I'll post a new version in a couple of days or so, maybe. ;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/find-file-dwim.el ;; ;; created: 2024-07-22 ;; version: 0.1.0 (require 'cl-lib) (require 'psea) ; https://dataswamp.org/~incal/emacs-init/psea.el (defun buffers () (mapcar #'buffer-name (buffer-list)) ) ;; (buffers) (defun mod-time-sec (f) (let ((s (time-convert (file-attribute-modification-time (file-attributes f)) 'integer) )) (list s f) )) ;; (mod-time-sec "~/.emacs") (defun remove-data (ds) (mapcar #'cadr ds) ) (defun sort-mod-time-sec (&optional dir) (or dir (setq dir default-directory)) (let ((fs (directory-files dir nil nil t))) (remove-data (reverse (cl-sort (mapcar #'mod-time-sec fs) #'> :key #'car)) ))) ;; (sort-mod-time-sec) (defun psea-hit (s fs &optional max gov) (and max (setq fs (seq-take fs max))) (or gov (setq gov 70) ) (cl-loop with perc with res for f in fs do (setq perc (sdp s f)) (when (< gov perc) (cl-pushnew (list perc f) res) ) finally return (remove-data (cl-sort res #'> :key #'car)) )) ;; (psea-hit "buffer-menu" (buffers)) ;; (psea-hit "find-file-dwim.el" (sort-mod-time-sec)) (defun re-hit (re fs &optional max) (and max (setq fs (seq-take fs max))) (cl-remove-if-not (lambda (f) (string-match re f)) fs) ) ;; (re-hit "line" (buffers)) ;; (re-hit "line" (sort-mod-time-sec) 1000) (provide 'find-file-dwim) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-07-25 9:24 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-21 22:10 find-file-dwim.el Emanuel Berg 2024-07-22 3:33 ` find-file-dwim.el Emanuel Berg 2024-07-22 14:02 ` find-file-dwim.el Philip Kaludercic 2024-07-22 15:40 ` find-file-dwim.el Emanuel Berg 2024-07-23 0:47 ` find-file-dwim.el Emanuel Berg 2024-07-23 6:41 ` find-file-dwim.el Philip Kaludercic [not found] ` <87jzhcqw4a.fsf@dataswamp.org> 2024-07-23 10:20 ` find-file-dwim.el Philip Kaludercic 2024-07-23 13:08 ` find-file-dwim.el Emanuel Berg 2024-07-23 13:01 ` find-file-dwim.el Emanuel Berg 2024-07-23 7:06 ` find-file-dwim.el Michael Albinus 2024-07-25 9:24 ` find-file-dwim.el Emanuel Berg 2024-07-22 5:32 ` find-file-dwim.el Emanuel Berg
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.