Blog Post My Must Emacs Functions
https://ismailefe.org/blog/emacs\_functions/ I wrote a blog post about the Emacs functions I use every day. It might be common knowledge for most people here, but I think there may be some inspiration that can be taken.
https://redd.it/1b82kqk
@r_emacs
company-reftex, but choosing citation and reference macros to insert à la reftex
I use both RefTeX and company-reftex for latex documents. For choosing the bibliographic reference, I much prefer company-reftex. But I like how C-c ]
(reftex-citation)
allows choosing from a list of citation formats (ditto for reftex-reference
). The problem is that reftex-citation
takes you to RefTeX's mechanism for choosing the bibliographic reference, which is not company-reftex.
So I am now doing this:
;; From my reftex-cite-format; for real, this is a longer list
(defvar my-cite-options
'("\\cite{}" "\\citep{}" "\\citealp{}" "\\citepp.~{}"))
(defun my-cite-menu ()
"Insert citation based on user choice."
(interactive)
(insert (completing-read "Choose citation type: " my-cite-options))
(backward-char)
(company-complete))
;; Preserve muscle memory
(bind-key (kbd "C-c ") 'my-cite-menu reftex-mode-map)
(Same comments apply to `reftex-reference`, where I reuse my `reftex-ref-style-alist`, and create a `my-reference-menu`).
This seems to me like the obvious solution because: a) it preserves muscle memory; b) I can reuse my lists of citation options and reference styles, and if I wanted to go back to a pure-reftex solution it would be simple; c) I can continue easily choosing structure; d) I use company-reftex; e) it seems simple enough.
But I have not found anything similar when searching for it. I wonder if I am doing something silly, or reinventing a wheel (and ending up with a square wheel as a result, given my elisp ignorance).
[https://redd.it/1b26hx6
@r_emacs
Weekly Tips, Tricks, &c. Thread
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.
Don't feel constrained in regards to what you post, just keep your post vaguely, generally on the topic of emacs.
https://redd.it/1b20xgn
@r_emacs
line-to-parse)
)
)
)
)
)
Can one of you experts suggest how to do it?
https://redd.it/1b1xjjc
@r_emacs
Grammarly in Emacs
What are the options for using Grammarly in Emacs? I was testing lsp-grammarly but was not able to set it up properly. And now I'm testing flyckeck Grammarly, it is better but the explanation of the issue with text is not helpful. My English is not perfect and I have problems understanding what to do to fix the grammar mistakes. Example:
>The noun phrase first element seems to be missing a determiner before it. Consider adding an article.
I don't understand what this hint suggests. The browser extension has a suggestion that you can click to fix the grammar mistakes. Does any Emacs mode have something similar? I thought that lsp mode use company mode to allow fixing grammar mistakes from dropdown menu, but I was told that the company mode only works with completion and doesn't work with lsp-grammarly.
I can fix mistakes by hand, but I need to have a list of fixes to apply. lsp-grammarly had even more cryptic hints "Correct article usage". Those are only in browser extension but there is a proper grammar listed that I can apply.
https://redd.it/1b1s7wk
@r_emacs
with possible narrowing."
(interactive "P")
(when (display-graphic-p)
(when refresh
(org-remove-inline-images beg end)
(when (fboundp 'clear-image-cache) (clear-image-cache)))
(let ((end (or end (point-max))))
(org-with-point-at (or beg (point-min))
(let* ((case-fold-search t)
(file-extension-re (image-file-name-regexp))
(link-abbrevs (mapcar #'car
(append org-link-abbrev-alist-local
org-link-abbrev-alist)))
;; Check absolute, relative file names and explicit
;; "file:" links. Also check link abbreviations since
;; some might expand to "file" links.
(file-types-re
(format "\\[\\[\\(?:file%s:\\|attachment:\\|[./~]\\)\\|\\]\\[\\(<?\\(?:file\\|attachment\\):\\)"
(if (not link-abbrevs) ""
(concat "\\|" (regexp-opt link-abbrevs))))))
(while (re-search-forward file-types-re end t)
(let* ((link (org-element-lineage
(save-match-data (org-element-context))
'(link) t))
(linktype (org-element-property :type link))
(inner-start (match-beginning 1))
(path
(cond
;; No link at point; no inline image.
((not link) nil)
;; File link without a description. Also handle
;; INCLUDE-LINKED here since it should have
;; precedence over the next case. I.e., if link
;; contains filenames in both the path and the
;; description, prioritize the path only when
;; INCLUDE-LINKED is non-nil.
((or (not (org-element-property :contents-begin link))
include-linked)
(and (or (equal "file" linktype)
(equal "attachment" linktype))
(org-element-property :path link)))
;; Link with a description. Check if description
;; is a filename. Even if Org doesn't have syntax
;; for those -- clickable image -- constructs, fake
;; them, as in `org-export-insert-image-links'.
((not inner-start) nil)
(t
(org-with-point-at inner-start
(and (looking-at
(if (char-equal ?< (char-after inner-start))
org-link-angle-re
org-link-plain-re))
;; File name must fill the whole
;; description.
(= (org-element-property :contents-end link)
(match-end 0))
(progn
(setq linktype (match-string 1))
(match-string 2))))))))
(when (and path (string-match-p file-extension-re path))
(let ((file (if (equal "attachment" linktype)
(progn
(require 'org-attach)
(ignore-errors (org-attach-expand path)))
(expand-file-name path))))
(when (and file (file-exists-p file))
(let ((width (org-display-inline-image--width link))
(old (get-char-property-and-overlay
(org-element-property :begin link)
Selecting which monitor to create new frames on
I added a bit of functionality to show which monitor is which when I use `make-frame-on-monitor`! honestly, makes a big difference :) Bound to `s-f`
​
https://i.redd.it/qw0lmc5vu7lc1.gif
https://redd.it/1b1r9xx
@r_emacs
Using mu4e-dashboard-mode
I am trying to use Nicholar Rougier's `mu4e-dashboard-mode` (https://github.com/rougier/mu4e-dashboard). It was quite easy to use it, except for one small issue. Suppose I am in the dashboard and click or select “Inbox”. Now when I quit “Inbox” it goes the mu4e's default (ugly) dashboard. How do I prevent that from happening and only use the dashboard from above?
https://redd.it/1b1dj2p
@r_emacs
Dap-Mode LLDB Debug Template for Rust
For anyone that's interested. I have a debug template that works well for me running dap-mode for debugging rust with lldb. Here's what works for me, including finding the target debug binary. I think the projectile functions could be replaced with LSP workspace variables/functions but this works for so I haven't tried.
(add-hook 'rustic-mode-hook (lambda ()
(dap-register-debug-template "Rust LLDB Debug Configuration"
(list :type "lldb-mi" ;; Make sure the path to lldb-mi is in your path
:request "launch"
:name "Rust::Run"
:MIMode "lldb"
:target (concat (projectile-project-root) "target/debug/" (projectile-project-name)) ;; Requires that the rust project is a project in projectile
:environment
:cwd "${workspaceFolder}"))))
​
https://redd.it/1b1d9l6
@r_emacs
Exploring completion-at-point-functions and treesit
I have been using go templ and htmx to write web server for a while. There is a templ-ts-mode for Emacs user to use. But the functionalities are so limited that it does not have HTML keyword completion. I tried to integrate web-mode or html-mode into it but no success. Both the source code of web-mode and html-mode are so complicated that I don't even know where to find the auto-completion related functions.
So I decided to do it my own way, with the help of built-in treesit, it was a fun and successful experience. I recommend more of you try out the treesit related stuffs.
Here is my blog post about it.
writing go templ with emacs
https://redd.it/1b19bs3
@r_emacs
Emacs Doom Org Mode Python Execution Issue
Hello, I've been using Emacs Doom on my MacBook Air M1 for a year. Since I reset it and reinstalled everything, I've been facing an issue when I execute src bloc code in Org Mode (c-c c-c).
I have a virtual environment (venv) with the correct Python modules installed in my environment. When I try to execute a scraping code, for example, I get this error as output:
PYTHONELeval("try:\n with open ...
Does anyone know how to resolve this issue? Thank you!
PS: When I use Org Mode source code blocks with basic Python modules, I don't encounter any issues.
https://redd.it/1b0ym2h
@r_emacs
How to create a report or get stats of a habit with org-mode/org-habit?
I can see the habits I'm tracking in the agenda, but I wanted to see details about one habit, like number of times I marked that habit as DONE, how many days without breaking the habit, etc. How could I do that?
https://redd.it/1b0n20v
@r_emacs
My basic vanilla Emacs, ef-winter theme.
​
https://preview.redd.it/43lewwuq0zkc1.png?width=1920&format=png&auto=webp&s=6c45736abbcb67f0e9af0aa5239ee6b6baa4aa98
https://redd.it/1b0of1z
@r_emacs
Use org tables with custom elisp functions
Just wanted to show you how to use org tables with custom elisp functions, in case you dont know its possible:
The following table shows results from a questionnaire:
#+name: sus-questionnaire-results
#+caption: SUS Questionnaire Results
#+attr_latex: :align l|r|r|r|r|r|r|r|r|r|r|l :font \fontspec{Noto Sans Condensed Light}
| USER | Q1 | Q2 | Q3 | Q4 | Q5 | Q6 | Q7 | Q8 | Q9 | Q10 | SUS |
|------+----+----+----+----+----+----+----+----+----+-----+------|
| U1 | 5 | 2 | 2 | 1 | 3 | 4 | 3 | 2 | 1 | 1 | 60.0 |
| U2 | 5 | 2 | 4 | 2 | 5 | 1 | 4 | 1 | 4 | 1 | 87.5 |
| U3 | 5 | 2 | 4 | 1 | 4 | 2 | 4 | 1 | 4 | 3 | 80.0 |
#+tblfm: $12='(ux:sus-calc-score-per-row '($2..$11));N
The SUS column is calculated for each row using the values from column 2 to 11. When the ‘N’ flag is used, all referenced elements are parsed as numbers and interpolated as Lisp numbers
Here is the elisp function:
(defun ux:sus-calc-score (lst)
(let ((counter 0))
(mapcar (lambda (x)
(setq counter (1+ counter))
(if (= 0 (% counter 2))
(- 5 x)
(1- x)))
lst)))
(defun ux:sus-calc-score-per-row (lst)
(* (apply '+ (ux:sus-calc-score lst)) 2.5))
Thats all!
https://redd.it/1b0jpu9
@r_emacs
C-x s with / in org-mode
Hi 👋
I've always had this problem and I want to see if someone can please help me: I have the following code in my config:
;; Update Emacs automatically with disk changes
(setq global-auto-revert-mode t)
(setq global-auto-revert-non-file-buffers t)
;; Set backup directory for files
(setq backup-directory-alist \(("." . ,(expand-file-name "backups/" user-emacs-directory))))
;; Set auto-saves directory for buffers
(make-directory (expand-file-name "auto-saves/" user-emacs-directory) t)
(setq auto-save-visited-file-name t)
(setq make-backup-files t)
(setq backup-inhibited nil)
(setq auto-save-list-file-prefix (expand-file-name "auto-saves/sessions" user-emacs-directory) auto-save-file-name-transforms \((".*" ,(expand-file-name "auto-saves/" user-emacs-directory) t)))
;; Disable lock files - enable if they cause trouble while compiling
;; (setq create-lockfiles nil)
;; Set directory for temp projectile and lsp files
(setq projectile-known-projects-file (expand-file-name "tmp/projectile-bookmarks.eld" user-emacs-directory) lsp-session-file (expand-file-name "tmp/.lsp-session.v1" user-emacs-directory))
;; Make backups to backup directory
(setq
backup-by-copying t
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
It creates #(https://filename.org)# files as backups in the directory, which is really nice. But, if I have a [/\] in an org header (a progress thing for a checklist), it continually asks upon hitting `C-x s` if I want to save the file. If I quit out of Emacs with `C-x C-c`, then it will not only ask, but also say that some buffers are modified, and do I want to really quit? I find this behavior to be a little weird. I'm just looking to see if anyone can help me make it so that backups are saved/taken care of silently in the background, and when hitting `C-x s`, it doesn't prompt me to save the backup file each time. Instead, it prompts for normal (non-backup) buffers.
I don't know *why* it continually updates the backup files if I have a [/\] in the header, but it does. If anyone has any ideas, please let me know?
Thanks! 🙃
https://redd.it/1b0e328
@r_emacs
project with disjoined directories
Hi,
In projectile or emacs's project.el, is there a way to support a project consisting of disjoint folders? i.e. folders without common parents? Or a way to exclude folders that I don't want to be included?
​
Thanks
https://redd.it/1b7tkgc
@r_emacs
Is there anything I can do to make Eglot's completion as smooth as Neovim's lsp?
Recently, I've started using Emacs again, mainly because Emacs 29.2 has built-in eglot and treesit. I spent about a week configuring it to see if the current Emacs can achieve the smoothness of lsp code completion on par with Neovim.
My system is a MacBook Pro M1 MAX, so there should be no problem with hardware performance.
I am using emacs-plus@29 and have enabled nativecomp. Here are the parts related to lsp code completion and performance in my configuration, I did everything I can find to boost the performance but still not as fast as Neovim's lsp (via gopls and rust-analyzer).
Is there anything to improve?
early-init.el
;; Minimize garbage collection during startup
(setq gc-cons-threshold most-positive-fixnum)
;; Lower threshold back to 8 MiB (default is 800kB)
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold (expt 2 23))))
(setq read-process-output-max (* 4 1024 1024))
(setq process-adaptive-read-buffering nil)
init.el
;; gcmh to optimize gc
(use-package gcmh
:ensure t
:straight t
:config
(setq gcmh-high-cons-threshold (* 128 1024 1024))
(add-hook 'after-init-hook (lambda ()
(gcmh-mode))))
;; Eglot
(use-package eglot
:custom
(fset #'jsonrpc--log-event #'ignore)
(eglot-events-buffer-size)
(eglot-sync-connect nil)
(eglot-connect-timeout nil)
(eglot-autoshutdown t)
(eglot-send-changes-idle-time 3)
(flymake-no-changes-timeout 5)
(eldoc-echo-area-use-multiline-p nil)
(setq eglot-ignored-server-capabilities '( :documentHighlightProvider))
:config
(add-to-list 'eglot-server-programs '((python-mode python-ts-mode) . ("pyright-langserver" "--stdio"))))
(defun maybe-start-eglot ()
"Exlude some mode from eglot."
(let ((disabled-modes '(emacs-lisp-mode dockerfile-ts-mode)))
(unless (apply 'derived-mode-p disabled-modes)
(eglot-ensure))))
(add-hook 'prog-mode-hook #'maybe-start-eglot)
(use-package eglot-booster
:ensure t
:straight (:type git :host github :repo "jdtsmith/eglot-booster")
:after eglot
:config
(eglot-booster-mode))
(with-eval-after-load 'eglot
(setq completion-category-defaults nil))
;; Corfu
(use-package corfu
:ensure t
:straight (corfu :files (:defaults "extensions/*")
:includes corfu-popupinfo)
:custom
(corfu-auto t)
(corfu-auto-prefix 1)
(corfu-auto-delay 0)
(corfu-quit-no-match 'separator)
:config
(setq completion-cycle-threshold 3)
(setq tab-always-indent 'complete)
(global-corfu-mode)
(corfu-popupinfo-mode))
(use-package cape
:straight t
:ensure t
:config
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
(use-package kind-icon
:straight t
:ensure t
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
;; orderless
(use-package orderless
:ensure t
:straight t
:init
;; Tune the global completion style settings to your liking!
;; This affects the minibuffer and non-lsp completion at point.
(setq completion-styles '(orderless partial-completion basic)
completion-category-defaults nil
completion-category-overrides nil))
(with-eval-after-load 'eglot
(setq completion-category-defaults nil))
​
https://redd.it/1b25904
@r_emacs
I'm trying to get Latex working in Emacs for GPTEL:
Greetings,
I'm using doom emacs, and I followed all the instructions to enable Latex in doom emacs, but, when I use gptel to query with gpt4all, whenever I query math equations it's not showing up in the nice latex, so, any tips on how to get this working, so I can view the math and physics equations in a nice way. Thanks for the help.
https://redd.it/1b20e5a
@r_emacs
Newbie question for text manipulation and parsing?
Hi
​
I am just dabbling into emacs and elisp code so please assume i have no idea what i am doing
​
So i have a string of the form
​
Exp pkt:req: (requvc::transaction@6094583) { responseexpected: 0x0 txnphase: TXNPHASEUNINITIALIZED begincycle: x endcycle: x pd: { txnid: 0xc54 resperr: CHIRSPERROK reqsize: CHISIZE32B resp: CHIRSPI opcode: CHIDATNONCOPYBACKWRDATA tgtid: 0xcc srcid: 0x25 } enablea1: 0xx reset: 0xx }
​
​
And i want to convert it into something like this
​
Exp pkt:req: (requvc::transaction@6094583)
|-------------------+-------------------------+---------------------------|
| responseexpected | 0x0 | |
| txnphase | TXNPHASEUNINITIALIZED | |
| begincycle | x | |
| endcycle | x | |
|-------------------+-------------------------+---------------------------|
| pd | | |
| | txnid | 0xc54 |
| | resperr | CHIRSPERROK |
| | reqsize | CHISIZE32B |
| | resp | CHIRSPI |
| | opcode | CHIDATNONCOPYBACKWRDATA |
| | tgtid | 0xcc |
| | srcid | 0x25 |
|-------------------+-------------------------+---------------------------|
| enablea1 | 0xx | |
| reset | 0xx | |
|-------------------+-------------------------+---------------------------|
I started creating a parser but got lost :(
I copied over the temporary line to a temporary buffer, figured out where the curly braces are and captured the points
but when i started manipulating the buffer my calculated points went for a toss :(
Then i did not know why i was in the buffer and not just copy the like and work on it ...
(defun rd/my-parser(buffer)
"my parse to parse data structure and print them"
(interactive
(let (
(buffer-local (read-buffer "Bufer Name: "))
)
(list buffer-local)
)
)
(message "\n\n------------------------------------------")
(let (
(cur-buf (current-buffer))
(line-to-parse (buffer-substring (line-beginning-position) (line-end-position)))
(braces '())
(pos-cons '())
)
(save-excursion
(with-current-buffer (get-buffer-create buffer)
(erase-buffer)
(goto-char (point-max))
(insert line-to-parse)
(goto-char (line-beginning-position)) ;; start of line
;; extract out all the braces
(while (and (search-forward "}" (line-end-position) t) (< (point) (line-end-position))) ;; search for the first
(setq pos-cons (cons nil (point)))
(forward-list -1)
(setcar pos-cons (point))
(goto-char (cdr pos-cons))
(push pos-cons braces)
(message (prin1-to-string (current-buffer)))
)
;; (message (prin1-to-string braces))
;; (message (prin1-to-string (current-buffer)))
(dolist (pos braces)
(goto-char (car pos))
(insert "\n")
(goto-char (cdr pos))
(insert "\n")
(setq line-to-parse (buffer-substring (car pos) (cdr pos)))
(delete-region (car pos) (cdr pos))
(message
'org-image-overlay)))
(if (and (car-safe old) refresh)
(image-flush (overlay-get (cdr old) 'display))
(let ((image (org--create-inline-image file width)))
(when image
(let* ((image-pixel-cons (image-size image t))
(image-pixel-h (cdr image-pixel-cons))
(y 0.0) (dy (/ (default-font-height) image-pixel-h 1.0))
(dummy-zone-start nil)
(dummy-zone-end nil)
(ovfam nil))
(org-with-point-at (org-element-property :begin link)
(while (< y 1.0)
(if (= y 0.0)
;; Overlay link
(push (org--make-inline-image-overlay
(point)
(org-element-property :end link)
(list (list 'slice 0 0.0 1.0 dy) image))
ovfam)
;; Overlay dummy lines
(move-end-of-line 1)
(insert (propertize "\n" 'line-height t))
(let ((start (point)))
(insert " ")
(if (not dummy-zone-start)
(setq dummy-zone-start (pos-bol)))
(push (org--make-inline-image-overlay
start
(point)
(list (list 'slice 0 y 1.0 dy) image))
ovfam)))
(setq y (+ y dy)))
(setq dummy-zone-end (point)))
(push (make-overlay dummy-zone-start dummy-zone-end) ovfam)
(push ovfam org-inline-image-overlay-families))))))))))))))))
(defun org-display-inline-remove-overlay-family (ov after _beg _end &optional _len)
"Remove inline-display overlay family if a corresponding region is modified."
(when (and ov after)
(when (overlay-get ov 'org-image-overlay)
(image-flush (overlay-get ov 'display))) ;; cdr here?
(catch 'break
(dolist (ovfam org-inline-image-overlay-families)
(when (memq ov ovfam)
(setq org-inline-image-overlay-families
(delq ovfam org-inline-image-overlay-families))
(org--delete-inline-image-overlay-family ovfam)
(throw 'break))))))
(defun org-remove-inline-images (&optional beg end)
"Remove inline display of images which start between BEG and END."
(interactive)
(let* ((beg (or beg (point-min)))
(end (or end (point-max)))
(overlays (overlays-in beg end)))
(dolist (ovfam org-inline-image-overlay-families)
(when (memq (car (last ovfam)) overlays)
(setq org-inline-image-overlay-families
(delq ovfam org-inline-image-overlay-families))
(org--delete-inline-image-overlay-family ovfam)))))
edit: formatting
https://redd.it/1b1sgyd
@r_emacs
My config for sliced org images
[Some](https://stackoverflow.com/questions/78047832/org-mode-inline-images-display-with-insert-sliced-image/78064990) people (myself included) wanted smoother scrolling of org inline images, which can be achieved with insert-sliced-image functionality.
So I made the following overrides of `org-toggle-inline-images` & friends which does the trick in my init.el. Let me know what you think!
;; Image display
(defvar-local org-inline-image-overlay-families nil
"A list of elements corresponding to displayed inline images in the
current buffer. Each element is a list of overlays making up the
displayed image.
The first element in each list is an overlay over the dummy characters
inserted to position the slices. The remaining elements are the slices
themselves; the last element is the topmost slice.")
(put 'org-inline-image-overlay-families 'permanent-local t)
(defun org--delete-inline-image-overlay-family (ovfam)
"Delete the overlay family OVFAM from its buffer."
(dolist (ov (cdr ovfam))
(delete-overlay ov))
(delete-region (overlay-start (car ovfam)) (1+ (overlay-end (car ovfam)))))
(defun org--inline-image-overlay-families (&optional beg end)
"Return image overlay families which start between BEG and END."
(let* ((beg (or beg (point-min)))
(end (or end (point-max)))
(overlays (overlays-in beg end))
result)
(dolist (ovfam org-inline-image-overlay-families result)
(when (memq (car (last ovfam)) overlays)
(push ovfam result)))))
(defun org-toggle-inline-images (&optional include-linked beg end)
"Toggle the display of inline images.
INCLUDE-LINKED is passed to `org-display-inline-images'."
(interactive "P")
(if (org--inline-image-overlay-families beg end)
(progn
(org-remove-inline-images beg end)
(when (called-interactively-p 'interactive)
(message "Inline image display turned off")))
(org-display-inline-images include-linked nil beg end)
(when (called-interactively-p 'interactive)
(let ((new (org--inline-image-overlay-families beg end)))
(message (if new
(format "%d images displayed inline"
(length new))
"No images to display inline"))))))
(defun org--make-inline-image-overlay (start end spec)
"Make overlay from START to END with display value SPEC.
The overlay is returned."
(let ((ov (make-overlay start end)))
(image-flush image)
(overlay-put ov 'display spec)
(overlay-put ov 'face 'default)
(overlay-put ov 'org-image-overlay t)
(overlay-put ov 'modification-hooks
(list 'org-display-inline-remove-overlay-family))
(when (boundp 'image-map)
(overlay-put ov 'keymap image-map))
ov))
(defun org-display-inline-images (&optional include-linked refresh beg end)
"Display inline images.
An inline image is a link which follows either of these
conventions:
1. Its path is a file with an extension matching return value
from `image-file-name-regexp' and it has no contents.
2. Its description consists in a single link of the previous
type. In this case, that link must be a well-formed plain
or angle link, i.e., it must have an explicit \"file\" or
\"attachment\" type.
Equip each image with the key-map `image-map'.
When optional argument INCLUDE-LINKED is non-nil, also links with
a text description part will be inlined. This can be nice for
a quick look at those images, but it does not reflect what
exported files will look like.
When optional argument REFRESH is non-nil, refresh existing
images between BEG and END. This will create new image displays
only if necessary.
BEG and END define the considered part. They default to the
buffer boundaries
Getting a handle on windows in emacs
I've been getting fairly familiar with emacs but I am still struggling with controlling the windows (i.e. the panes) in emacs. My main issue is emacs presuming to create new windows when I do not want it to. I especially want all of my regular file buffers to always open in the same window. Does anyone have suggestions for controlling your windows? Are there any really good packages or dot-files I should be looking at to solve this issue?
https://redd.it/1b1op08
@r_emacs
How Emacs changed my life
https://www.slideshare.net/yukihiro_matz/how-emacs-changed-my-life
https://redd.it/1b1ccit
@r_emacs
M-x Reloaded: The Second Golden Age of Emacs
https://batsov.com/articles/2024/02/27/m-x-reloaded-the-second-golden-age-of-emacs/
https://redd.it/1b1bi9s
@r_emacs
Nerd Font Problems - Fedora KDE
I just installed Fedora KDE and I've run into an embarrassing problem. Neither my terminal of choice (wezterm) nor Emacs can find my installation of nerd fonts. I installed them as per normal in \~/.local/share/fonts and they show up in the fonts section of the GUI appearance manager (and are completely usable in KDE). However, they can't be found by wezterm or Emacs.
Anyone had this problem before? I've never had an issue with openSUSE or Arch.
I've also installed them in /usr/share/fonts and of course ran sudo fc-cache -v.
https://redd.it/1b0znkb
@r_emacs
Slightly odd font rendering in macOS
Hi, I installed emacs in macOS (emacs-plus@29) and immediately noticed that the font rendering was a bit off, slightly darker or bolder than in other apps. For example, this is Source Code Pro (Regular 15) in VSCode (above) and in emacs (below):
https://preview.redd.it/ctq8s69dyzkc1.png?width=342&format=png&auto=webp&s=079e1ee0f334bf0a80516fd81ce8ff0123d75bbf
Does emacs use a different font rendering engine than the rest of the system?
I tried setting ns-use-thin-smoothing but found no difference in rendering.
Thanks!
https://redd.it/1b0tdbv
@r_emacs
Anyone using lsp-mode with ts-ls having trouble with it overwriting imports?
On Friday I updated all my lsp language servers (I use ts-ls) and all my emacs packages, and now whenever I save it's overwriting all my imports incorrectly; it's also (stupidly) adding an emacs backup file to my `tsconfig.json` file. I've been looking at the lsp-mode documentation, but I can't figure out how to disable code actions on save (and honestly, I'd rather keep that and just turn off whatever it's trying to do to the imports, but I haven't found a setting for that). I've also been looking at the configuration options on the ts-ls repo, but I'm unsure of how to set those through emacs-lsp, and couldn't find any documentation on setting server-specific settings.
Here's what it's doing:
Pre-save
Typescript file:
import {
ChartFieldAssignment
} from "../types"
import {
barChart,
histogram
} from "./chart-generators"
import { DEFAULT_POINT_SIZE } from "./vega-map/constants"
import {
COUNTIES_KEYS,
STATES_KEYS,
COUNTRIES_KEYS
} from "./topojson-constants"
tsconfig.json
:"include": [
"./package.json",
"./src/**/*",
"./*.js",
"./.*.js",
"./test-config/**/*",
"./webpack.*.ts",
"./webpack.config.common.ts",
"./webpack.config.dev.ts",
"./webpack.config.prod.ts",
"./webpack.license-plugin.ts",
"./webpack.module.ts",
"./webpack.resolve.ts"
],
import {
ChartFieldAssignment
} from "../../Projects/immerse/src/components/sql-notebook/types"
import {
barChart,
histogram
} from "./chart-generators"
import { DEFAULT_POINT_SIZE } from "../../Projects/immerse/src/components/sql-notebook/visualization/chart-generators"
import {
COUNTIES_KEYS,
STATES_KEYS,
COUNTRIES_KEYS
} from "../../Projects/immerse/src/components/sql-notebook/visualization/topojson-constants"
tsconfig.json
:"include": [
"./package.json",
"./src/**/*",
"./*.js",
"./.*.js",
"./test-config/**/*",
"./webpack.*.ts",
"./webpack.config.common.ts",
"./webpack.config.dev.ts",
"./webpack.config.prod.ts",
"./webpack.license-plugin.ts",
"./webpack.module.ts",
"./webpack.resolve.ts", "../../.emacs.d/backups/!home!matzy!Projects!immerse!src!components!sql-notebook!visualization!utils.ts.~59~"
Problem with accents in org-mode
I currently have 2 org files on the same emacs/win10 session, that behave differently: When i press an accentuated character "é" on the keyboard, the buffer on the left displays "é", the buffer on the right "\\351". This seems to be independent from whatever i set with "set-buffer-file-coding-system". Any help would be appreciated!
https://redd.it/1b0nj15
@r_emacs
I'm loosing my mind over emacs buffers
A while back i made a post on a different Problem where i mentioned this as well, but i'm not able to track this down. So i'm, once again, asking for help here.
Basically, at a random point in time after starting emacs, it will create buffers named "*emacs*" in the background.
https://preview.redd.it/sy147bu3mxkc1.png?width=898&format=png&auto=webp&s=72f99a091f59e8332e2a1a067b2b2ad8eeff33ae
They seem to be somehow related to me moving through files. I have only my init.el file open and moving up and down makes new buffers appear in that list. This isn't consistent though. If i restart emacs, i can move through my init file just fine. And at some point, this just starts happening.
Some of those buffers are empty, and some have just "Lisp Expression:" with nothing else written in them.
I already tried stripping down my config and haven't been able to track it down. I ripped the whole completion setup out, threw out treemacs and such, ran without all the eglot and language modes and tried without org and evil configuration. Nothing seems to help.
Is there a hook or option i can use to get more information on how or by what those buffers are created? Maybe write a verbose log on those events or such? Although i've worked with emacs for quite some time, i seem to be pretty bad at configuring and troubleshooting it, so some hints would help me a lot here.
If someone wants to look at my config, the current state is here: Dominik Schlack / Domacs · GitLab
https://redd.it/1b0hnf4
@r_emacs
From Doom to Vanilla Emacs
https://blog.dornea.nu/2024/02/22/from-doom-to-vanilla-emacs/
https://redd.it/1b0do6m
@r_emacs