reddit / emacs
Weekly Tips, Tricks, &c. Thread
AutoModerator · 2022-07-27 08:15
This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.
[See this search for previous "Weekly Tips, Tricks, &c." Threads.](https://www.reddit.com/r/emacs/search?q=Weekly+tips&restrict_sr=on&sort=new&t=all)
Don't feel constrained in regards to what you post, just keep your post vaguely, generally on the topic of emacs.
trae · 2022-07-28 05:06
Does anyone have advice for how to get auto-revert/auto-save to work? I'm trying to use org directory on multiple devices and less than stellar now. What's everyone using?
CorysInTheHouse69 · 2022-07-28 06:15
Does anyone use orderless and eshell? Together they seem to either be slow or not work at all for completion depending on the circumstance
akirakom · 2022-07-28 06:58
Use syncthing for synchronizing your org directory
Phil-Hudson · 2022-07-28 11:59
I'm not sure I've understood exactly what you're asking for, so forgive me if this is off-target. To auto-save all your open Org files:
(add-hook 'auto-save-hook #'org-save-all-org-buffers)
This presupposes that you have customized `auto-save-default` to a non-nil value.
trae · 2022-07-28 14:45
Yup, that's what I had, and also:
(global-auto-revert-mode 1)
(setq auto-revert-use-notify nil)
(setq global-auto-revert-non-file-buffers nil)
But it was behaving strangely. auto-save would save buffers that weren't modified (but were open) and auto-revert...wouldnt. I thought I might be missing something.
[deleted] · 2022-07-28 18:18
[deleted]
GeorgeStorm · 2022-07-29 14:39
Having a go at refreshing my emacs config after a long time of not touching it and having a couple of issues.
Trying to setup lsp mode to give c# dev stuff but don't seem to get any flycheck/company stuff working in a csharp buffer but not sure why as it seems like both modes are 'on/working' I just don't get any completion options or underlines etc. (code taken from various guides on how to setup emacs for c#)
https://pastebin.com/MtJ3KxaG
​
And I'm having an issue with doom-modeline where it seems to cutoff the end of the line despite there being loads of room in the middle.
​
Any ideas?
walseb · 2022-07-29 15:58
I find myself writing in this pattern quite often which is error prone.
(defun my/foo-or-bar ()
(pcase (completing-read "Select: " '( "foo" "bar" ))
("foo" (foo-fun))
("bar" (bar-fun))))
Notice how foo and bar is written twice. Is there something like `completing-read-pcase` out there? Thanks.
vjgoh · 2022-07-29 18:01
Some eglot advice, please? I'm getting hugely long stalls--sometimes up to a minute long. The project I'm working on is pretty large (it's an Unreal Engine game) and if I bring up the eglot log, clang is always doing a lot of work in the background. But the input stalls in emacs are intermittent, seemingly random (like, I don't know when the code I'm typing is going to cause one or not; I'm always halfway through a line, though) and incredibly frustrating.
Anyone know if there's something I can do here? I tried using lsp-mode early on, but it actually just didn't work at all out of the box. I'm sure there's a way I can set it up, and I will definitely try if I can't get eglot to work more smoothly. (I'm blaming it on eglot because even if clang is churning in the background, emacs absolutely should not be blocking.)
papercatlol · 2022-07-29 23:58
(let ((collection '(("foo" . foo-fun) ("bar" . bar-fun))))
(alist-get (completing-read "Select: " collection nil t)
collection nil nil #'equal))
walseb · 2022-07-30 05:32
That's better, thanks!
by_wicker · 2022-07-30 15:15
What would be a good way to associate a value with a `tab-bar` tab? I'm thinking analogous to frame-parameters, but for tabs.
[My purpose is associating a hostname with the tab, with a `hydra` that offers activities in the context of a `default-directory` on that host. I currently made a frame-parameter alist of tab-name to hostname on the frame, but tab names aren't necessarily static (they actually are for my use, but I was thinking of making it more generic). When I close the tab I kill all tramp buffers to that host. It works really well for my workflows so I'd like to refine it and perhaps share it.]
[deleted] · 2022-07-31 02:54
[deleted]
[deleted] · 2022-07-31 03:09
[deleted]
w0ntfix · 2022-07-31 17:21
Use the profiler to find out where all the time is going
GeorgeStorm · 2022-08-01 14:24
As an update thought I'd try using corfu instead of company in case that was causing issues but it didn't give me completion windows in lisp files let alone the .cs so maybe something more fundamentally is wrong with my config? Flycheck also says there are no errors when I deliberately make one so nothing to do with LSP mode seems to be working, but the messages look ok to me, and when I look at the modeline it says it's connected and I don't get any errors.
`LSP :: Yasnippet is not installed, but lsp-enable-snippet' is set to t. You must either install yasnippet, or disable snippet support.`
`LSP :: Connected to [csharp-ls:17920/starting].`
`Wrote c:/Users/George/AppData/Roaming/.emacs.d/.emacs.desktop.lockDesktop: 1 frame, 3 buffers restored.For information about GNU Emacs and the GNU system, type C-h C-a.`
`Emacs loaded in 3.31 seconds with 15 garbage collections.`
`LSP :: csharp-ls: csharp-ls is released under MIT license and is not affiliated with Microsoft Corp.; see` [`https://github.com/razzmatazz/csharp-language-server`](https://github.com/razzmatazz/csharp-language-server)
`LSP :: csharp-ls: initializing, csharp-ls version 0.5.2.0; options are: {"SolutionPath":null,"LogLevel":4}`
`...`
`LSP :: csharp-ls: OK, 11 project files loaded`
_viz_ · 2022-08-02 05:16
AFAICT, tab parameters are created on-demand so there's no way to attach arbitrary parameters unless you change the tar-bar-tabs-function.
by_wicker · 2022-08-02 10:58
Yeah, the more I have dug around the more it seems there's no obvious, tidy, simple way.
attento_redaz · 2022-08-02 16:51
I haven't tried it, but maybe [lsp-bridge](https://github.com/manateelazycat/lsp-bridge) is worth a look. clangd is listed as supported and it's explicitly aimed at not slowing down Emacs...
oantolin · 2022-08-02 20:58
I use them together and don't seem to have any problems. I hope you figure it out. u/w0ntfix's suggestion of using the profiler is a good idea.
CorysInTheHouse69 · 2022-08-02 20:59
I managed to figure it out. I had some weird orderless settings turned on that made eshell not cooperate