Emacs

368 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 2 years ago
MODERATORS
301
 
 

when i open an epub book i need to disable evil-mode in order to be able to jump to next chapter when reading

302
 
 

I am trying to replace straight with Elpaca but I have some troubles with loading some of my local packages that are not from Melpa.

The use-case is to load laas a package for latex snippets. I use the following code

(use-package aas
:elpaca nil
:load-path  (lambda () (expand-file-name "custom/" user-emacs-directory))
)

(use-package laas
:elpaca nil
:load-path  (lambda () (expand-file-name "custom/" user-emacs-directory))
:config
(aas-set-snippets 'laas-mode
;; set condition!
:cond #'texmathp ; expand only while in math
"On" "O(n)"
"O1" "O(1)"
;; bind to functions!
"Sum" (lambda () (interactive)
(yas-expand-snippet "\\sum_{$1}^{$2} $0"))
"Span" (lambda () (interactive)
(yas-expand-snippet "\\Span($1)$0"))
"lr(" (lambda () (interactive)
(yas-expand-snippet "\\left($0\\right)"))
"lr[" (lambda () (interactive)
(yas-expand-snippet "\\left[$0\\right]"))
"lr{" (lambda () (interactive)
(yas-expand-snippet "\\left\\{$0\\right\\}"))
)
(laas-mode)
)

Both files `aas.el` and `laas.el` are in my `(lambda () (expand-file-name "custom/" user-emacs-directory))` durectory and with straight these lines of code worked well but when I switched to Elpaca, laas was not loaded anymore. I tried to add :after tex, do not change anything. I tried to add a hook for latex mode and it also do not change, the laas package is not even loaded.

Can someone help me with this please?

303
 
 

(use-package elfeed)

(leader-key "w" elfeed)

Is it possible to combine the two in a simple way? I tried using :general keyword in use-package ensuring that it loads after general, but it still does not work...

304
 
 

I'm facing a really tough issue with colors getting all messed up after switching to wayland. Is there any simple guide to understand how to change fonts/faces colors in emacs?

305
 
 

So my BT keyboard + trackpad is looking worse for wear.

It was cheap and cheerful with a winning form factor. Other KBs came and went, but it survived.

I need a replacement.

It's been used with emacs (DooM) with my tablet and / or phone for a few years, and has a few shortcomings (see yellow sticker).

I now also have a SteamDeck, which is basically an Arch box, and I'd love a BT keyboard with that.

Does anyone have a portable setup they'd like to share?

Also, is there an emacs-y way to lisp my way out of things like:

  • keys being missing (#);
  • ESC being on a function layer?
306
307
 
 

ellama is a tool for interacting with LLMs from Emacs. It now uses llm library as a backend and supports various providers.

308
 
 

As the title says, when i run M-x ispell when it reaches a word under an org mode heading it won't unfold the heading, so my cursor is just on the actual heading and not the incorrect word and then when i quit ispell i can't unfold that heading with tab. I have to kill and yank the heading to get it working again. I pasted some of my init file below incase that helps.

  • I've tried this with flyspell disabled and get the same results, so i think it is an ispell issue.
  • I have also tried this with emacs -q and running M-x ispell and get the same issue.
  • I'm using emacs+ on mac

Thanks!

Org settings:

* Org mode
** General tweaks
#+begin_src emacs-lisp
  ;; indent with tabs for better readability
  (add-hook 'org-mode-hook #'org-indent-mode)
  ;; (setq org-indent-indentation-per-level 4)

  ;; them source blocks as they would in their native mode.
  (setq org-src-fontify-natively t
        org-src-tab-acts-natively t
        org-confirm-babel-evaluate nil)
#+end_src

** Packages
*** org-bullets
#+BEGIN_SRC emacs-lisp
  ;; Org bullets makes things look pretty
  (use-package org-bullets
    :ensure t
    :config
    (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
  #+END_SRC

ispell and flyspell settings:

** spell checking
*** ispell
#+begin_src emacs-lisp
  (use-package ispell
    :ensure t)

  (setq ispell-program-name "aspell")
  (setq ispell-extra-args '("--sug-mode=ultra"))
  (setq ispell-dictionary "english")
#+end_src

*** flyspell
#+begin_src emacs-lisp
  (use-package flyspell
    :ensure t
    :config
    (setq ispell-program-name "aspell")  ; Use Aspell as the spell checker
    (add-hook 'text-mode-hook 'flyspell-mode)
    (add-hook 'prog-mode-hook 'flyspell-prog-mode))

  ;; recommended to speed up flycheck
  (setq flyspell-issue-message-flag nil)

  ;; easy spell check
  (global-set-key (kbd "") 'ispell-word)
  (global-set-key (kbd "C-S-") 'flyspell-mode)
  (global-set-key (kbd "C-M-") 'flyspell-buffer)
  (global-set-key (kbd "C-") 'flyspell-check-previous-highlighted-word)
  (defun flyspell-check-next-highlighted-word ()
    "Custom function to spell check next highlighted word"
    (interactive)
    (flyspell-goto-next-error)
    (ispell-word)
    )
  (global-set-key (kbd "M-") 'flyspell-check-next-highlighted-word) 

309
310
 
 

I have been using `find` with `consult-find`, but it's a bit slow. I'm wondering if it would be possible to speed it up using some other tool such as `fd`. I noticed that the consult README talks about `consult-fd` but I cannot locate that function anywhere in my version which is I think the latest `0.35`. Can anyone help with this?

Also, similarly, consult-grep is a bit slow. Wondering if one can swap in `ag` for example?

311
1
Search engine (alien.top)
submitted 2 years ago by UnitFew5153@alien.top to c/emacs
 
 

I want to use set google as the search engine for emacs but can't figure out the process

312
 
 

I'm using the adwaita-dark theme but the mode-line is too wide for my liking. In the theme code there's a variable (mode-line-padding 10) which I assume sets the width of the mode line. Is there a way for me to reset this value in my init file, either before or after loading the theme code, to make it narrower? I'm using the code below to load it.

(use-package adwaita-dark-theme
  :ensure t
  :config
  (load-theme 'adwaita-dark t))

313
 
 

Hi.

Ainother day, another emacs doubt.

I'm using ivy-mode, and when I do M-x and write, the order of candidates for completion seems weird for me. I figure it obeys some logic, but I'd like to change it. For example:

I do M-x and write coun bu

Results are:

counsel-switch-buffer (this one is selected by default)

counsel-ibuffer

counsel-buffer-or-recentf

counsel-minibuffer-history

For me, counsel-buffer-or-recent should be the first candidate, since that's the one with shortest "distance" between a match for coun and a match for bu. Is there a way to make results be sorted by this? So that those 4 candidate should appear like:

counsel-buffer-or-recentf

counsel-ibuffer

counsel-minibuffer-history

counsel-switch-buffer

Another example. I make M-x package-install then write consu. There are almost 15 results before consult. Being the shortest one matching perfectly the string, IMHO this should be the first candidate.

Another example, M-x dire. Results:

A couple of logical results (because they start with dired-)

tramp-crypt-add-directory

dired-jump-other-window

How is it that dired-jump appears after tramp-crypt-add-directory if the match for dire is further in the tramp-... candidate?

Any hint on this?

Thanks in advance.

314
 
 

I know this question has been asked before and I know about org-roam, I am just not sure if org-roam is the right solution for me. Right now, I use one big org file to take notes which I export to pdf. This works nicely, but it would be nice to also have access to the concepts in the larger org file at a granular level (ie. bite-sized notes which reference one another and are organized based on their subject matter). I would also like to tag information that is not in org format, if possible. I was thinking that org-roam & org-transclusion could be used to make main subject files, while org-roam could be used to make a link to an embedded pdf that comes from the concept I am referencing, when I don't need to explicitly review the material in whatever notes I am taking. Has anybody done anything like this? Any tips are appreciated. Thanks.

315
 
 

I am trying to use dired on Windows. But, when I attempt to follow a shortcut in dired, it seems to open the shortcut file itself in a buffer instead of following the shortcut to the target directory.

I attempted to follow the installation instructions in this file starting on line 51: https://github.com/hidsh/elisp/blob/master/w32-symlinks.el.

When I byte-compiled the w32-symlinks.el file, Emacs informed me that there were incorrectly escaped quotes in the function located on line 171. I removed those parts of the docstring and byte-compiled the file without error. I also used the following code as specified in the directions.

(add-hook 'dired-load-hook

(lambda () (require 'w32-symlinks)))

But, when I use dired to follow a Windows shortcut it still opens it as a file.

Is there another file explorer package that I can use? Is there another solution?

Thank you for your time.

Edit 1:

I did end up making some progress. I deleted my configuration, reinstalled emacs, and then followed the instructions again. Emacs now starts with configuration choices related to the w32-symlinks package. I have tried a few different combinations. But, now when I attempt to use dired to open a windows shortcut I get the error "Wrong type argument: stringp, t" in the mini-buffer.

316
 
 

I know I can use M-x browse-url-of-buffer to create a temp file and render it on my default browser. But how could I render it with eww?

I tried the function suggested here, but I get the error message that says:

eww-display-html: Buffer nil doesn’t exist

The use case is the following:

  1. Export org as HTML (to a temp buffer);
  2. Render the HTML to a browser, my default browser or eww.

Any suggestions?

317
 
 

Code is:

(progn 
  (with-temp-buffer
(insert
 (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/alphapapa/org-ql/bd2dd12a417df5403954576756d9c24273d94379/tests/data.org")
   (goto-char url-http-end-of-headers)
   (buffer-substring (point) (point-max))))
;; remove sunrise stuff throwing error
(goto-char (point-min))
(while (re-search-forward "^%%(org-super-agenda--test-diary-sunrise)\\|^%%(org-super-agenda--test-diary-sunset)" nil t)
(replace-match "" nil nil))
(write-file "/tmp/tmp.org"))
  (let ((org-agenda-files '("/tmp/tmp.org"))
(org-agenda-finalize-hook nil))
(org-agenda-list nil "2017-07-05"))
  (delete-other-windows))

Thanks to /u/alphapapa for good data for this purpose.

I've attached what mine looks like, but basically just default modus dark theme.

Why? If you live in your org-agenda, you probably care about how it looks to some extent.

Maybe we can share cool parts that improve our living spaces :)

318
 
 

The emacs website has versions down to 22, but none of them seem to work correctly on Windows 98. I managed to get emacs 22 running, but it does not display correctly on screen. Only the -nw version runs correctly.

Is there any version that works well on the older OSes?

319
3
Emacs for Rust (alien.top)
submitted 2 years ago by Orest58008@alien.top to c/emacs
 
 

I just switched from neovim to emacs and one thing I miss is coc.nvim. It has a power to turn a barren neovim into anything I ever want from IDEs. I tried to do something like this and emacs learning curve got me. I cobbled together a simple config with eglot, company and rust-mode, but I can't get import completion to work. Any suggestions?

320
 
 

If I manually set dired-mouse-drag-files, open dired, then perform a mouse drag on any file Emacs immediately crashes. (Emacs 29.1 installed from the homebrew cask on macOS Ventura)

Checking here to see if anyone else has experienced this.

I searched the GNU bug tracker and (tbh I might not have searched in the right way) but I didn't find anything.

321
 
 

Hey there.

I'm a fan of Emacs, like you folks.

I use Emacs org every day, mainly for my teaching class. Furthermore, I learn Emacs for three years ago.

But I struggle to achieve my learning of Elisp. For example, taping lisp and elisp code with evil/lispy is a true nightmare (I use Prelude with few modes, btw), not to mention when I type code block within org.

I knew the learning curve is hard. But I didn't expect that much frustration to learn it. The documentation is austere. So few examples are given. There is too little blogs or books about Emacs, specifically about org and babel.

To illustrate my point, let's take the «*this*» kind-of macro in babel, that I found TODAY by CHANCE in this page : https://orgmode.org/manual/Results-of-Evaluation.html.

It's a game changer for a lot of my code, and would deserve a whole page to illustrate it. But no, it's given in a «niche» example.

Don't be mistaken, I found Babel/Org/Emacs wonderful, but what a pain in the ass to learn it !

For such an old and wise piece of software, I can't understand why we don't have a smooth learning experience with Emacs. A lot of people could benefit Org/Emacs, without the big hinder of the «lack» of documentation (mostly examples).

Am I the only one to experience this ?

322
 
 

Am I missing something or does the new yaml-ts-mode not having any rules for indentation? Seems odd in a language where indentation is semantically relevant.

GNU Emacs 29.1 (build 2, x86_64-unknown-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0) of 2023-08-03

Treesitter grammar installed and loaded via:

(use-package treesit-auto
  :config
  (add-to-list 'global-treesit-auto-modes '(not org-mode))
  (setq treesit-auto-install t)
  (global-treesit-auto-mode))
323
324
 
 

Repository: mini-echo

Echo buffer status in minibuffer window, get rid of mode-line.

features:

  • light-weight, very simple structure and no many configs compared to feebleline, mini-mdoeline, awesome-tray...
  • don't use mode-line at all, same experience in terminal
  • port lots of segments from doom-modeline

Have a try!

325
 
 

Thanks to Andreas (the original author of gccmacs), we can now "redump" Emacs even with some natively compiled elisp in the mix. I've been cautious in my experiments so far, but: this works on Windows!

From a MSYS2/MINGW64 bash shell:

$ bin/emacs --batch -Q -eval '(let ((custom-theme-load-path (list "/.emacs.d/elpa/cyberpunk-2019-theme-20191008.1133/"))) (require '"'"'erc) (load-theme '"'"'cyberpunk-2019 t) (enable-theme '"'"'cyberpunk-2019) (dump-emacs-portable "erc.pdmp"))'

$ bin/runemacs.exe --dump-file erc.pdmp -fs -l

This seems to get a "fullboth" frame with my theme pretty fast. Note, I can't trigger connection quite yet at that point; the runemacs call is loading my full init, and some parts that take a further moment.

Also, the first command, which created the custom portable dump called "erc.pdump" loaded by the second command, was nearly instant. Here's a look at what this did to size of the the pdmp file.

-rw-r--r-- 2 corwi corwi 16200096 Oct 24 18:10 src/emacs.pdmp
-rw-r--r-- 2 corwi corwi 16200096 Oct 24 18:10 src/emacs-30.0.50.3.pdmp
-rw-r--r-- 1 corwi corwi 16200096 Oct 24 18:10 src/bootstrap-emacs.pdmp
-rw-r--r-- 1 corwi corwi 16506656 Oct 24 18:35 +cl-lib.pdmp
-rw-r--r-- 1 corwi corwi 20006368 Oct 25 00:30 erc+cl-lib.pdmp
-rw-r--r-- 1 corwi corwi 19764904 Oct 25 00:43 erc.pdmp

view more: ‹ prev next ›