From: Philip Kaludercic <philipk@posteo.net>
To: Emanuel Berg <incal@dataswamp.org>
Cc: emacs-devel@gnu.org
Subject: Re: find-file-dwim.el
Date: Tue, 23 Jul 2024 06:41:05 +0000 [thread overview]
Message-ID: <87sew0k3um.fsf@posteo.net> (raw)
In-Reply-To: <87o76pq6hb.fsf@dataswamp.org> (Emanuel Berg's message of "Tue, 23 Jul 2024 02:47:44 +0200")
[-- 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
next prev parent reply other threads:[~2024-07-23 6:41 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 ` 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 ` Philip Kaludercic [this message]
[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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sew0k3um.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=emacs-devel@gnu.org \
--cc=incal@dataswamp.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).