reddit / emacs
Weekly Tips, Tricks, &c. Thread
AutoModerator · 2022-10-19 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.
HM0880 · 2022-10-19 14:46
Some commands and keybindings to maximize the current Emacs frame (i.e., "the main window" in OS-speak).
;; Fixes non-maximized window after C-x 5 2 on my chromebook
(setq x-frame-normalize-before-maximize t)
;; `toggle-frame-maximized' is bound to M-<f10> and ESC <f10> by default.
;; Maximize the frame; override `other-frame-prefix'.
(global-set-key (kbd "C-x 5 5") 'toggle-frame-maximized)
;; Minimize the Emacs frame
(global-set-key (kbd "C-x 5 4") 'suspend-frame)
;; I have <f1> set to run-or-raise Emacs, so <f2> seems natural to minimize Emacs
(global-set-key (kbd "<f2>") 'suspend-frame)
agumonkey · 2022-10-19 20:27
not emacs per se, but jack rusher did a talk about programming 'ux / ergonomics / pragmatics' with a lot of fun ideas about coding, past (lisp machines, smalltalk ... ) or more recent clojure based tools
https://www.youtube.com/watch?v=8Ab3ArE8W3s
hope you enjoy it
warning: poop emoji
trae · 2022-10-20 16:44
More of an org question, but is there a way to grab all `:CLOCK` and `:SCHEDULE` entries? I tried org-ql is a natural choice but it [doesn't handle ranged entries](https://github.com/alphapapa/org-ql/pull/237).
akirakom · 2022-10-21 18:15
You can use re-search-forward with one of the regular expressions defined in org.el to scan those entries.
arylcyclohexylameme · 2022-10-22 15:40
What are some packages people use to add/tweak basic functionality in emacs?
For some examples of what I mean, I tried ctrlf, I found it to be worse than the default search. My coworker suggested I install zoom-mode, but it hasn't clicked with me yet.
Are there any other packages like this that I should play around with? I'm finally getting to the point where I'm rolling my own, and my configuration is shockingly minimal. I have a feeling it's minimal because I only really know about the programming packages I use and org/etc.
eleven_cupfuls · 2022-10-22 17:16
If you're looking for something specific, you could do worse than the search box on Melpa: https://melpa.org/#/
If you just want to poke around for interesting stuff, I'd suggest reading the docs or the setup files themselves in the Emacs "distros": Doom, Prelude, Spacemacs... Just checking out other peoples' configs (they get posted and linked to here a lot) also generally yields something.
arylcyclohexylameme · 2022-10-22 17:54
Yeah, I'm mostly looking for interesting/most used packages. Thanks!
tmting · 2022-10-23 12:47
Then you should definitely check [awesome-emacs](https://github.com/emacs-tw/awesome-emacs). It's a great curated list of packages
mattplm · 2022-10-23 16:16
I have a problem and am not sure if it is related to lsp/eglot, to project.el or to me not knowing how to the language server itself. I hope I won't struggle to much to make myself clear.
I work on sizeable python a project that is organised around a main repo as well as other projects containing modules for the main repo.
Main repo looks like so:
.
├── README.md
├── tox.ini
├── LICENSE
├── [...]
├── modules
│ ├── [...]
In the `modules` directory, we symlink the modules developped in the other repos.
Is it possible to setup eglot so that when I work on a module in another repo, the root of the project is the root of the main repo?
lianacrossk7n · 2022-10-23 22:31
eglot uses project.el to figure out what a project's root should be. project.el by default picks the directory with a `.git` folder as the project's root folder. When you visit a file, Emacs follows the symlink to the module's directory outside(?) of your main project with it's own .git so that's why your module is the root instead of the main project.
A couple of possibilities to try:
- project.el can use the main repo as the root directory if your modules are defined as git submodules. one option would be to use this git feature to manage your main repo's modules. https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/project.el#L455
- Otherwise project.el has a `project-find-functions` hook that you might be able to use point it at the main project instead of the sub folder when a match is found. (i.e. when "this" buffer's directory matches one of my modules return the main repo as the project) As a non-example, I use this hook to support a .project file to mark non-git repos as projects:
```
(defun my/project-dot-project (dir)
"Allows a .project file to mark the root of a project."
(let ((project-file (locate-dominating-file dir ".project")))
(if project-file
(cons 'vc project-file)
nil)))
(add-hook 'project-find-functions #' my/project-dot-project)
```