From: Philip Kaludercic <philipk@posteo.net>
To: Andrew De Angelis <bobodeangelis@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: New Package: sticky-shell
Date: Mon, 12 Dec 2022 18:33:45 +0000 [thread overview]
Message-ID: <87a63stqt2.fsf@posteo.net> (raw)
In-Reply-To: <CAP5CrM3RhcdpR579nDsh6K1embNHf5Jz4nw=x-6-_t_gP1_HFw@mail.gmail.com> (Andrew De Angelis's message of "Sun, 11 Dec 2022 19:05:26 -0500")
[-- Attachment #1: Type: text/plain, Size: 884 bytes --]
Andrew De Angelis <bobodeangelis@gmail.com> writes:
> Hello everyone and thanks for all your work.
> I've made a new package that I would like to add to Elpa.
I assume you are referring to GNU ELPA (the only where contributors have
to sign the FSF CA?)
> The package provides a minor mode that creates a header in a shell buffer.
> The header shows the prompt above the top-visible line, allowing users to
> keep track of what prompt generated which output, even with very large
> multiple-line outputs.
> The package also has some customization features that can be used to
> determine which prompt to show in the header (it can be the latest-executed
> prompt, etc), and the look of the header.
Sounds interesting!
> This is the git repo: https://github.com/andyjda/sticky-shell, with
> additional info in the README and in the code's documentation.
Here are a few commends:
[-- Attachment #2: Type: text/plain, Size: 3411 bytes --]
diff --git a/sticky-shell.el b/sticky-shell.el
index 0fdc108..4d8aaa9 100644
--- a/sticky-shell.el
+++ b/sticky-shell.el
@@ -36,6 +36,8 @@
;;; Code:
(eval-when-compile
+ ;; Why are these only required during compilation? You appear to be
+ ;; using actual functions from these modules, not just macros.
(require 'eshell)
(require 'comint))
@@ -46,7 +48,6 @@
"Display a sticky header with latest shell-prompt."
:group 'terminals)
-
(defcustom sticky-shell-get-prompt
#'sticky-shell-prompt-above-visible
"Function used by sticky-shell-mode to pick the prompt to show in the header.
@@ -55,21 +56,23 @@ Available values are: `sticky-shell-latest-prompt',
`sticky-shell-prompt-above-cursor',
`sticky-shell-prompt-before-cursor'
or you can write your own function and assign it to this variable."
- :group 'sticky-shell
- :type 'function)
+ :type '(choice (function-item :tag "Prompt above visible" sticky-shell-prompt-above-visible)
+ (function-item :tag "Latest prompt" sticky-shell-latest-prompt)
+ (function-item :tag "Prompt above cursor" sticky-shell-prompt-above-cursor)
+ (function-item :tag "Prompt before cursor" sticky-shell-prompt-before-cursor)
+ other))
(defcustom sticky-shell-prompt-modifiers
- ()
+ '()
"List of functions modifying the prompt before it is displayed in the header.
See `sticky-shell-modified-prompt' for an explanation
on how the functions are applied."
- :group 'sticky-shell
:type 'list)
(defun sticky-shell-prompt-current-line ()
"Return the current line and remove the trailing newline char."
(let ((prompt (thing-at-point 'line)))
- (aset prompt (- (length prompt) 1) 0) ; remove the newline ending char
+ (aset prompt (1- (length prompt)) 0) ; remove the newline ending char
prompt))
(defun sticky-shell-latest-prompt ()
@@ -78,6 +81,8 @@ on how the functions are applied."
(save-excursion
(goto-char (point-max))
(forward-line -1)
+ ;; Perhaps you should pull this into a separate function, as the
+ ;; check appears quite often. Another idea, as the pattern appease quite similar in general, you could also
(if (derived-mode-p 'eshell-mode)
(eshell-previous-prompt 1)
(comint-previous-prompt 1))
@@ -129,23 +134,25 @@ macro-expands to:
(upcase
(funcall sticky-shell-get-prompt))
\\='face \\='minibuffer-prompt)"
+ ;; The case distinction appears unnecessary (thread-first (foo)) is
+ ;; the same as (foo).
(if sticky-shell-prompt-modifiers
`(thread-first
(funcall sticky-shell-get-prompt)
,@sticky-shell-prompt-modifiers)
+ ;; Perhaps it would be better/cleaner if
+ ;; `sticky-shell-prompt-modifiers' were a list of function that
+ ;; all get applied on the result of (funcall
+ ;; sticky-shell-get-prompt) in order?
(funcall sticky-shell-get-prompt)))
;;;###autoload
(define-minor-mode sticky-shell-mode
"Minor mode to show the previous prompt as a sticky header."
- :group 'comint
:global nil
- :lighter nil
- (if sticky-shell-mode
- (setq-local header-line-format
- (list '(:eval
- (sticky-shell-modified-prompt))))
- (setq-local header-line-format nil)))
+ (setq-local header-line-format
+ (and sticky-shell-mode
+ '((:eval (sticky-shell-modified-prompt))))))
(provide 'sticky-shell)
;;; sticky-shell.el ends here
[-- Attachment #3: Type: text/plain, Size: 369 bytes --]
> Let me know if you have any questions and if there are any issues with
> adding this to the Package Archive. (I do not have push-access to the git
> repository)
I don't think there should be any issue. The only thing I would
recommend would be to consider adding an .elpaignore file to avoid
adding the screenshots to the tarball.
> Thank you!
>
> Best,
> Andrew
next prev parent reply other threads:[~2022-12-12 18:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 0:05 New Package: sticky-shell Andrew De Angelis
2022-12-12 18:33 ` Philip Kaludercic [this message]
2022-12-12 18:45 ` Stefan Monnier
2022-12-12 18:55 ` Akib Azmain Turja
2022-12-13 3:27 ` Jean Louis
2022-12-13 4:07 ` Andrew De Angelis
2022-12-13 14:22 ` Stefan Monnier
2022-12-13 18:24 ` Jean Louis
2022-12-14 5:23 ` Andrew De Angelis
2022-12-14 13:41 ` Stefan Monnier
2022-12-16 10:20 ` Jean Louis
2022-12-28 15:34 ` Andrew De Angelis
2022-12-30 14:45 ` Jean Louis
2023-02-19 20:56 ` Andrew De Angelis
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=87a63stqt2.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=bobodeangelis@gmail.com \
--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 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).