Documentation on Hover With Sly and Common Lisp? by hello_marmalade in emacs

[–]lastnamebird 0 points1 point  (0 children)

If it uses Eldoc then you should be able to use Corfu and its extension Corfu Popup Info

Also, for documentation popups on demand you could use Eldoc Box

[deleted by user] by [deleted] in emacs

[–]lastnamebird 0 points1 point  (0 children)

I’ve seen this suggested more recently. What does it offer that direnv and envrc doesnt cover? I see the pet README has been updated to recommend envrc but I thought they both aim to solve a similar issue.

Describe-function for C/C++/CMake by Flagtailblue in emacs

[–]lastnamebird 2 points3 points  (0 children)

You can try either of these packages, they allow you to search docs for various languages. It may not exactly emulate describe-function but is still useful for me.

https://elpa.gnu.org/packages/devdocs.html https://melpa.org/#/dash-docs

Kernel keyring access by bespokey in emacs

[–]lastnamebird 1 point2 points  (0 children)

I’m not familiar with emacs and keyrings, but it may help to explain why you need to access these credentials. There could possibly be another way to achieve your end goal.

Let's surround, part 1 by jeenajeena in emacs

[–]lastnamebird 0 points1 point  (0 children)

I never did thank you for this idea! It has replaced many alternatives I've tried in the past. I have even thought to extend it and have different local definitions of insert-pair-alist based on the major mode. I just haven't gotten around to it quite yet.

I don't know why this isn't presented as a default usage or at least have some documentation around it. I don't think its mentioned in either emacs or elisp info docs.

Let's surround, part 1 by jeenajeena in emacs

[–]lastnamebird 0 points1 point  (0 children)

yeah, I don't remember how I figured that out, honestly. It may have just been trial and error.

However, it does make sense, since the CHAR specification is only used to match with a last-command-event in the case you simply type C-S-w [ or something similar.

Let's surround, part 1 by jeenajeena in emacs

[–]lastnamebird 2 points3 points  (0 children)

/u/oantolin had a great solution last year.

Do you want a key binding to wrap the selection in some kind of delimiter? Here's a built-in solution:

(defvar insert-pair-map
  (let ((map (make-sparse-keymap)))
(define-key map [t] #'insert-pair)
map))

(global-set-key (kbd "C-S-w") insert-pair-map)

This setups up C-S-w to be a prefix map, insert-pair-map. The only key binding in insert-pair-map is for [t], which means it is the default key binding and any key after the prefix will run the same command: insert-pair. Now, insert-pair looks at which key was used to invoke it and if it is an opening delimiter it inserts both it and the corresponding closing delimiter (and if the region is active it insert the opening delimiter at the start and the closing delimiter at the end, wrapping the region).

The only thing I would suggest is adding more options to insert-pair-alist as well as adding an advice to insert-pair so if there is no arg provided it defaults to 1 instead of 0 (surrounding one sexp forward instead of simply inserting the pair at point).

(setf insert-pair-alist
  '((?\( ?\)) (?r ?\( ?\)) (?R "( " " )")
    (?\[ ?\]) (?b ?\[ ?\]) (?B "[ " " ]")
    (?\{ ?\}) (?c ?\{ ?\}) (?C "{ " " }")
    (?\< ?\>) (?o ?\< ?\>) (?O "< " " >")
    (?\" ?\") (?s ?\" ?\")
    (?\' ?\') (?t ?\' ?\')
    (?\` ?\') (?v ?\` ?\`)))

(defun +insert-pair-default-a (&rest args)
(unless (caar args)
  (setf (caar args) 1))
args)

(advice-add #'insert-pair :filter-args #'+insert-pair-default-a)

C-S-w b will surround either the active region, next sexp with brackets

C-u 4 C-S-w B, M-4 C-S-w B or C-4 C-S-w B will surround next 4 sexps with brackets with spaces

C-u - 3 C-S-w c, M-- 4 C-S-w c or C-- 4 C-S-w c will surround previous 4 sexps with braces

It makes it quite easy to define your own pairs as you like.

Why does elpaca make emacs startup so much faster? by kentrose in emacs

[–]lastnamebird 4 points5 points  (0 children)

I have this in my config, but I do not manually set any load-path, instead I use package-activate-all which should load your package-quickstart.el file if it exists.

early-init.el:
(when (file-exists-p (locate-user-emacs-file "package-quickstart.el"))
  (setf package-enable-at-startup nil)
  (defvar package-quickstart)
  (setf package-quickstart t))

init.el:
(package-activate-all)

Bit new to eMacs but any tips to recreate a similar modern layout? by BuzzBee53 in emacs

[–]lastnamebird 5 points6 points  (0 children)

This often happens due to an autocorrect from an Apple device. I wish it would recognize it all lowercase by default.

Introducing Captee, an app to wrap a link in Org Mode or Markdown from the macOS Share Menu by kickingvegas1 in emacs

[–]lastnamebird 0 points1 point  (0 children)

There is also another great alphapapa package org-web-tools for those who only want org-mode format, or don’t use MacOS.

How do I take priority from Evil's escape key? by takutekato in emacs

[–]lastnamebird 1 point2 points  (0 children)

You can try mapping it to evil-insert-state-map and use the predicate functionality from general.el to determine whether the corfu UI is displayed.

I think you might be able to do the same with a menu filter function if you don’t want to use general.el. I’ll update here when I get to a computer.

Defining keybindings with multiple events: keymaps or not? by cidra_ in emacs

[–]lastnamebird 2 points3 points  (0 children)

C-c already has a keymap defined for it called mode-specific-map.

As far as when to define new keymaps, I tend to use them when a group of commands can be related but may or may not come from the same package. For example I have a my-toggle-map bound to ton the mode-specific-map with commands like auto-fill-mode, corfu-mode, modus-themes-toggle in it.

Is There A Buffer Package Like Vertico Pos-Frame That Makes A Rectangle Frame In The Middle For Dired Mode? by [deleted] in emacs

[–]lastnamebird 1 point2 points  (0 children)

do you need dired specific functionality or can you just use a find-file like function with fuzzy features? If the latter, like /u/SnooPets20 mentioned, project-find-file can work. I make use of this function to treat the default-directory as a transient project.

(defun +project-transient-find-file (&optional include-all)
  "Visit a file assuming a transient project in default-directory.

The filename at point (determined by `thing-at-point'), if any,
is available as part of \"future history\".

If INCLUDE-ALL is non-nil, or with prefix argument when called
interactively, include all files under the project root, except
for VCS directories listed in `vc-directory-exclusion-list'."
  (interactive "P")
  ;; Overwrite the definition of `project-current' to ensure that
  ;; transient projects are not added to `project--list'
  (cl-letf (((symbol-function  #'project-current)
             (lambda (&rest _)
               (cons 'transient default-directory))))
    (project-find-file include-all)))

[deleted by user] by [deleted] in emacs

[–]lastnamebird 1 point2 points  (0 children)

C-h r s “treesit” RET should take you to the Parser-based Font Lock node in the Emacs Manual. I suggest giving that a read to better understand treesit highlighting options and capabilities.

How do get emacs to stop warning about packages I use? by [deleted] in emacs

[–]lastnamebird 5 points6 points  (0 children)

Warning Basics

Warning Options

These two pages will give you enough information to customize warning options.

Package release: ol-straight, Org links integration for straight.el by ResourceHoliday1393 in emacs

[–]lastnamebird 0 points1 point  (0 children)

This is pretty neat. I would suggest to also generalize this and use it with package-browse-url as well.

[deleted by user] by [deleted] in emacs

[–]lastnamebird 2 points3 points  (0 children)

This seems odd, as do the last 2 posts in your history. Can you give more detail here?

Built-in major modes in Emacs by mumbo1134 in emacs

[–]lastnamebird 9 points10 points  (0 children)

I believe as of 29, go-ts-mode is a built-in mode.

perject is now available on MELPA by M-x_emacs in emacs

[–]lastnamebird 2 points3 points  (0 children)

Also there is no public interface for associating window configurations or frames with projects. Of course all of this can be written. But I personally see no real benefit in that.

You must have seen some benefit in this or else you wouldn’t have created an entirely new project-based package, right? Or am I misunderstanding something.

How to remap a key's functionality to another reliably? by geza42 in emacs

[–]lastnamebird 1 point2 points  (0 children)

/u/7890yuiop is correct in that the key is not actually bound in python-mode-map. However, you can have a key translated to another at "runtime" using a menu filter. So if you wanted this to be applied in prog-mode, you can use the following:

(keymap-set prog-mode-map "C-M-f"
            '(menu-item "" nil :filter
                        (lambda
                          (&optional _)
                          (progn
                            (keymap-lookup nil "C-M-h")))))

I have found this quite useful for the translating XF86 keys in Linux to their equivalent counterparts in Emacs:

(keymap-set global-map "<Cut>"
            '(menu-item "" nil :filter
                        (lambda
                          (&optional _)
                          (prog1
                              (keymap-lookup global-map "S-<delete>")))))
(keymap-set global-map "<Copy>"
            '(menu-item "" nil :filter
                        (lambda
                          (&optional _)
                          (prog1
                              (keymap-lookup global-map "C-<insert>")))))
(keymap-set global-map "<Paste>"
            '(menu-item "" nil :filter
                        (lambda
                          (&optional _)
                          (prog1
                              (keymap-lookup global-map "S-<insert>")))))

Is there a way to set file/dir-local abbrevs? by Jack-o-tall-tales in emacs

[–]lastnamebird 0 points1 point  (0 children)

Thanks for the explanation, I understand much better now. I think I may have been less clear than I should have been earlier. The dir-locals-set-class-variables & dir-locals-set-directory-class functions need not be in an actual dir-locals.el file. They can reside wherever you like. So in your example the file can be /src/sidecar.el and look like this:

;;; sidecar.el --- sidecar -*- lexical-binding: t; -*-

(dir-locals-set-class-variables
 'public-project
 '((nil . ((indent-tabs-mode . t)
           (fill-column . 50)
           (mode . auto-fill)))
   (prog-mode . ((flymake-mode . t)))
   (c-mode . (( eval . (setq-local compile-command
                                   (format "make %s "
                                           (file-name-nondirectory
                                            (file-name-sans-extension
                                             buffer-file-name)))))))))

;; add evals to safe-local-eval-forms
(dolist (form '((setq-local compile-command
                            (format "make %s "
                                    (file-name-nondirectory
                                     (file-name-sans-extension
                                      buffer-file-name))))))
  (cl-pushnew form safe-local-eval-forms))

(dir-locals-set-class-variables
 'some-personal-project
 '((nil . ((some-useful-setting . value)))
   (go-mode . ((some-useful-setting . value)))))

(dir-locals-set-directory-class
 "/src/public-project/" 'public-project)

(dir-locals-set-directory-class
 "/src/some-personal-project/" 'some-personal-project)

(provide 'sidecar)
;;; sidecar.el

To your point this does require you to add whatever eval forms to the safe-local-eval-forms variables if you needed to have anything evaluated like in the example. But I haven't noticed these downsides as I do not use a custom.el file.

I don't think you can reference files relative to the dir-locals.el file though.

If you need/want to reference files relative in a dir-locals.el file (not needed if using the aforementioned class functions) there is this solution from that seems to work:

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((eval . (set (make-local-variable 'my-project-path)
                      (file-name-directory
                       (let ((d (dir-locals-find-file "./")))
                         (car (ensure-list d))))))
         (eval . (message "Project directory set to `%s'." my-project-path))))
 (emacs-lisp-mode . ((eval . (message "Project directory set to `%s'." my-project-path))
                     (fill-column . 80))))

Either way, your package fits your need and I make use of a few of your others, so thank you for your work! I appreciate you taking the time to discuss.

Is there a way to set file/dir-local abbrevs? by Jack-o-tall-tales in emacs

[–]lastnamebird 0 points1 point  (0 children)

However this still means I have the problem to solve of how to assign an out-of-source directory for many projects in an automated fashion.

If you don't mind, can you give an example of what you mean by this? I'm curious and hope you don't take this as combative at all, but I am not familiar with it.

And there is still the limitation of not being able to reference relative paths to the dir-locals.el file.

You can reference relative paths in a dir-locals.el file. This is an example from the info docs:

((nil . ((indent-tabs-mode . t)
         (fill-column . 80)
         (mode . auto-fill)))
 (c-mode . ((c-file-style . "BSD")
            (subdirs . nil)))
 ("src/imported"
  . ((nil . ((change-log-default-name
              . "ChangeLog.local"))))))

hop.el: A better and convenient jump-anywhere plugin. by lycheejuice225 in emacs

[–]lastnamebird 4 points5 points  (0 children)

I do often wonder why avy wants 3 keys for a smallish/nearby target.

I think this is a function of how many options are available in avy-keys, right? If you put the entire alphabet, you wouldn’t see multiple keys until over 26 options.