all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: emacs-devel@gnu.org
Subject: Re: find-file-dwim.el
Date: Mon, 22 Jul 2024 14:02:17 +0000	[thread overview]
Message-ID: <878qxtle3a.fsf@posteo.net> (raw)
In-Reply-To: <87le1urtgp.fsf@dataswamp.org> (Emanuel Berg's message of "Mon, 22 Jul 2024 05:33:42 +0200")

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



  reply	other threads:[~2024-07-22 14:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Philip Kaludercic [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878qxtle3a.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.