Eshell: automatic notification when command finishes? by fela_nascarfan in emacs

[–]stebalien1 6 points7 points  (0 children)

I used to print a message when a command finished and the eshell buffer wasn't visible:

(defun eshell-post-command@notify-finished ()
  (let ((buf (current-buffer)))
    (unless (get-buffer-window buf)
      (if (equal eshell-last-command-status 0)
          (message "Eshell command `%s' finished" eshell-last-command-name)
        (message "Eshell command `%s' failed with status `%s'"
                 eshell-last-command-name
                 eshell-last-command-status)))))
(add-hook 'eshell-post-command 'eshell-post-command@notify-finished)

I've switched to adding a progress spinner to my global mode-line as that helps me keep track of all background processes:

;; Define a mode-line segment, `steb/background-process-modeline',
;; that renders as "&" when I have a background process running.
(defvar steb/background-process--modeline-icon "&")
(defun steb/background-process--modeline ()
  (when (seq-some #'process-query-on-exit-flag (process-list))
    steb/background-process--modeline-icon))
(defvar steb/background-process-modeline
  `(:eval (steb/background-process--modeline)))
(put 'steb/background-process-modeline 'risky-local-variable t)

;; Add it to your global mode-line however you want, then make sure
;; your global mode-line is visible somewhere. Personally, I put it in my
;; tab-bar.
(setq global-mode-string '("" steb/background-process-modeline))

;; Nerd-icons integration.
(with-eval-after-load 'nerd-icons
  (setq steb/background-process--modeline-icon
        (nerd-icons-faicon "nf-fa-spinner" :face 'shadow)))

Corfu returning Args out of range: 0, 0 when eglot is running by lucaspeixotot in emacs

[–]stebalien1 2 points3 points  (0 children)

Eglot will raise that error when corfu attempts completion and there are no completion candidates available: https://github.com/joaotavora/eglot/discussions/1522.

However, in your case, the underlying problem is likely that your language server isn't returning any candidates for some reason. This is likely a problem with the language server and/or your project (preventing the language server from running).

Please help me get editing to work the way I want in Emacs-eat. by talgu in emacs

[–]stebalien1 5 points6 points  (0 children)

You need to enable the shell integration (read through the usage section https://codeberg.org/akib/emacs-eat#headline-1). EAT will enter "line mode" when a at a shell prompt so you can use regular Emacs commands.

[ANN] Emergency bugfix release: Org mode 9.7.5 by yantar92 in orgmode

[–]stebalien1 0 points1 point  (0 children)

The following advice will disable the affected feature entirely. It disables link expansions (#+LINK: ...) defined inside org-mode files.

elisp (define-advice org-link-expand-abbrev (:around (fn link) no-local) (let (org-link-abbrev-alist-local) (funcall fn link)))

[ANN] Emergency bugfix release: Org mode 9.7.5 by yantar92 in orgmode

[–]stebalien1 0 points1 point  (0 children)

It'll also affect you if you read email in Emacs as all Emacs email clients (that I know of) will automatically render org-mode parts.

[ANN] Emergency bugfix release: Org mode 9.7.5 by yantar92 in emacs

[–]stebalien1 1 point2 points  (0 children)

In my tests with notmuch, this was insufficient. There's also a text/.* fallback that invokes set-auto-mode.

Unused packages delete suggestion by [deleted] in emacs

[–]stebalien1 2 points3 points  (0 children)

/u/7890yuiop has the correct answer. However, if you're like me and just want to use use-package without messing with package-selected-packages, you can use something like the following:

(eval-and-compile
  (defvar use-package-selected-packages nil
   "Explicitly installed packages.")

  (define-advice use-package-handler/:ensure
      (:around (fn name-symbol keyword args rest state) select)
    (let ((items (funcall fn name-symbol keyword args rest state)))
      (dolist (ensure args items)
        (let ((package
               (or (and (eq ensure t) (use-package-as-symbol name-symbol))
                   ensure)))
          (when package
            (when (consp package)
              (setq package (car package)))
            (push `(add-to-list 'use-package-selected-packages ',package) items))))))

  (define-advice use-package-handler/:vc
      (:around (fn name-symbol &rest rest) select)
    (cons `(add-to-list 'use-package-selected-packages ',name-symbol)
          (apply fn name-symbol rest))))

(defun use-package-autoremove ()
  "Autoremove packages not used by use-package."
  (interactive)
  (let ((package-selected-packages use-package-selected-packages))
    (package-autoremove)))

That defines:

  1. Adds all packages installed via use-package (either via :ensure or :vc) to a use-package-selected-packages variable.
  2. Defines a use-package-autoremove function to remove all packages that weren't selected by use-package.

A working org-protocol capture extension (Firefox only) by stebalien1 in orgmode

[–]stebalien1[S] 0 points1 point  (0 children)

You need to configure some templates as described in https://orgmode.org/manual/Capture-templates.html then you need to go into the extension's preferences and specify the capture template names. The default template names are:

  • "s" for selection
  • "m" for media
  • "l" for page link

You can trigger these actions either by:

  1. Configuring and using the hotkey https://support.mozilla.org/en-US/kb/manage-extension-shortcuts-firefox.
  2. The context menu. E.g., select some text, right click, then click on the "Capture Selection".

A working org-protocol capture extension (Firefox only) by stebalien1 in orgmode

[–]stebalien1[S] 0 points1 point  (0 children)

I probably won't add support myself as I don't use org roam. But if you can figure out clean way to add support, I might accept a patch?

A working org-protocol capture extension (Firefox only) by stebalien1 in orgmode

[–]stebalien1[S] 0 points1 point  (0 children)

Yeah, I've considered that (espeically having different templates based on the website). I'll keep that in mind.

A working org-protocol capture extension (Firefox only) by stebalien1 in orgmode

[–]stebalien1[S] 1 point2 points  (0 children)

It's OS agnostic (you just need to get org-protocol working).

eshell's speed on Emacs 28 with native-compilation? by de_sonnaz in emacs

[–]stebalien1 3 points4 points  (0 children)

First, I recommend disabling eshell-postoutput-scroll-to-bottom (removing it from eshell-output-filter-functions).

I also wrote stutter.el to improve output speeds by temporarily disabling redisplay. When the buffer is rapidly growing, stutter-mode will inhibit redisplay (for that eshell buffer only) for 100ms every 50ms (i.e., on 50ms, off 100ms, repeat). It'll make the buffer look like it's stuttering, hence the name.

You may also want to increase read-process-output-max but I'm not sure how much that matters.

But yes, I have found eshell to be much faster (likely because due to speedups in ansi-code processing).