reddit / emacs

Identifying a package

remillard · 2022-06-28 13:18
I've got two questions rolling around today and I can't seem to sort either of them. First, I'm trying to setup my home emacs configuration based (loosely) on my work configuration, but doing it entirely through `use-package` instead of the Emacs package management. As a result, I'm not entirely sure dependencies are being installed though I understand they ought to be. In any event I've got a behavior on my work machine that I have not yet been able to get on my home machine, namely when I start typing a path in a string, I get completion on it based on the filesystem. [Here's a picture, hopefully.](https://imgur.com/gallery/OTN1L5K) In any event, I have `company` and `company-statistics` installed in both locations but I don't think that's what's doing the file completion suggestions. Any ideas what is causing that? Second question, there is a package that has a built-in version installed, however the gnu repository has a more recent version. If I use `use-package` to install, it says the package is already installed. Is there a way to force it to update if there's a newer version, or something along those lines? I am new to `use-package` and really haven't gotten the full swing of it yet. I also have a newer version that I just had to download from a site and in the past have just used adding a directory onto `load-path` and then `(require '<package name>)` which works, but would be interesting to sort out whether that behavior can be done with `use-package` as well as a shortcut. Anyhow, any help greatly appreciated!
deaddyfreddy · 2022-06-28 14:05
> I am new to use-package Have you read the documentation, though? I suppose it has answers to most of your questions.
remillard · 2022-06-28 14:42
Yeah I think I got the "loading a local package" portion figured out. I have not found a way to make \`use-package\` load a remote higher version over a built-in older version however. For example: (use-package verilog-mode :ensure t :pin gnu) does NOT work. Still have no idea what package is providing the file system completion help.
deaddyfreddy · 2022-06-28 16:51
> Still have no idea what package is providing the file system completion help. I believe it's company with company-files backend enabled.
remillard · 2022-06-28 17:20
Unfortunately, `company-files` not installed and I still have that behavior on the work machine. I've been through the list and nothing was jumping out at me. Two candidates that are installed on one side that gets file-name completions are projectile and treemacs, and these are not installed on the other side. I had hoped to delay that a bit since I'm still working on crafting some of the use packages, but I might just have to blow projectile in and see if it does it. There really aren't a lot of other candidates on the work machine that might be doing the completions.
remillard · 2022-06-28 17:35
AHA. I figured it out finally. It **IS** `company` however it requires having `global-company-mode` turned on which I did not have configured for company. So I had it installed, but I did not turn it on. Sheesh.
deaddyfreddy · 2022-06-28 18:58
(use-package company :ensure t :bind (:map company-active-map ("C-n" . company-select-next-or-abort) ("C-p" . company-select-previous-or-abort)) :hook (after-init . global-company-mode)) yep, that's what I use
wargxs · 2022-06-28 19:01
I don’t know how you can force use-package to install built in packages via elpa ; currently I install them manually via list packages and then everything works as expected
remillard · 2022-06-28 19:08
Yes, I think I did something similar. I didn't do any keybinds because next and prev seem to work automatically for me without binding. (use-package company :config (global-company-mode t)) (use-package company-statistics) But yeah, basically I'd installed it but never turned it on apparently. Doing all this configuration via `use-package` instead of Emacs's configuration menu is an interesting process.
remillard · 2022-06-28 19:09
Yeah I might have to just do that. I found a somewhat related issue in the `use-package` github issues page that makes me think there is no proper way to force update. If it's built-in and `use-package` can find it there, it won't go to any great lengths to update.
wargxs · 2022-06-28 19:12
https://github.com/jwiegley/use-package/issues/319 https://github.com/jwiegley/use-package/issues/955 True
FrozenOnPluto · 2022-06-28 20:58
For fun, you might want to look at vertico (or Selectrum) .. which gets you nice live updates to a list in the minibuffer, as you navigate around with the path/filenames; I also enable 'orderless' and 'marginalia' .. orderless lets you do things like find-file with 'foo bar' to find 'fooblahbar' and also 'barblahfoo' type filenames (orderless == out of order substring matching.) Coupled with vertico or selectrum, its a joy! Marginalia will present details in another column to the right, in vertico or selectrum (etc) -- with paths, it'll show the file permissions and sizes, but for stuff like C-h f (function list) it'll show function help strings, that sort of thing. Context sensitive extra details. Also a joy!
remillard · 2022-06-28 21:04
I will definitely save this and have to try these out sometime. Tricky trying to keep work going smoothly while also experimenting with tools! :D
thetemp_ · 2022-06-28 21:22
> Second question, there is a package that has a built-in version installed, however the gnu repository has a more recent version. If I use use-package to install . . . Use-package doesn't install packages. It can use the built-in package.el to ":ensure" that a missing package gets installed, but you have to tell it to do that. But in this instance, you want it to install a library that's already available on your system. From what I can recall, I don't believe use-package does that. If you want this to happen automatically every time you start Emacs (as opposed to just installing the newer version manually), you'll need to read up on how to configure package.el. See the "[Emacs Lisp Packages](https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html)" section in the Emacs manual