Emacs

2194 readers
1 users here now

Our infinitely powerful editor.

founded 5 years ago
MODERATORS
101
 
 

See my reply below (https://lemmy.ml/comment/3972018) for a working solution.


I've got quite a few useful minor modes enabled globally, namely puni-mode and display-line-numbers-mode.

However, I'd like to be able to disable (one or more of) them for certain major modes. For example, I don't want puni or display-line-number to be activated when using vterm.

I've been trying to make the following snippet do the job for me to no avail. What am I missing?

I'd appreciate any hints/help 🙏


(defvar bahman/display-line-numbers-mode.disabled-modes
  '(vterm-mode erlang-shell-mode)
  "Disable `display-line-numbers' for the specified modes.")

(defvar bahman/puni-mode.disabled-modes
  '(vterm-mode)
  "Disable `puni-mode' for the specificied modes.")

(defun bahman/after-change-major-mode-hook.disable-minor-modes ()
  "Disable certain minor modes for certain major modes 🤷.
See
  `bahman/display-line-numbers-mode.disabled-modes'
  `bahman/puni-mode.disabled-modes'"
  (with-current-buffer (current-buffer)
    (when (seq-contains-p bahman/display-line-numbers-mode.disabled-modes
                          major-mode
                          #'eq)
      (display-line-numbers-mode -1))
    (when (seq-contains-p bahman/puni-mode.disabled-modes
                          major-mode
                          #'eq)
      (puni-mode -1))))

(add-hook 'after-change-major-mode-hook
          #'bahman/after-change-major-mode-hook.disable-minor-modes)
102
 
 

I am looking for an app for note taking that is compatible with my Linux Org-roam setup?

103
-1
@emacs (mastodon.ml)
submitted 2 years ago by pashkafd4@mastodon.ml to c/emacs@lemmy.ml
 
 

@emacs
#emacs #neovim #vim
Есть ли руководство на русском языке по Emacs ?
Как и что какие клавиатурные команды выполняются.
Также интересен Вим и Неовим.

104
 
 

View ‘info’, ‘texi’, ‘org’ and ‘md’ files as ‘Info’ manual

105
106
107
 
 

cross-posted from: https://lemmy.ml/post/4692376

From GNU lists earlier today:

We have learned with deep sadness that Thien-Thi Nguyen (ttn) died in October 2022. Thien-Thi was a hacker, artist, writer, and long-time maintainer and contributor to many GNU programs as well as other free software packages. He was the GNU maintainer of the rcs, guile-sdl, alive, and superopt packages, and he was working on GNU Go as well.

Thien-Thi especially loved GNU Emacs, GNU Taler, and GNU Go: he was the author and maintainer of the xpm, gnugo, ascii-art-to-unicode, and hideshow GNU Emacs packages and made substantial contributions to many others such as vc, as well as to GNU Taler and its documentation.

We greatly miss Thien-Thi in the free software community - his death is a great loss to the Free World.

108
5
submitted 2 years ago* (last edited 2 years ago) by bahmanm@lemmy.ml to c/emacs@lemmy.ml
 
 

Suppose I need to find out if the intersection of an arbitrary number of lists or sequences is empty.

Instead of the obvious O(n^2^) approach I used a hash table to achieve an O(n) implementation.

Now, loop mini-language aside, is this idiomatic elisp code? Could it be improved w/o adding a lot of complexity?

You can view the same snippet w/ syntax highlighting on pastebin.

(defun seq-intersect-p (seq1 seq2 &rest sequences)
  "Determine if the intersection of SEQ1, SEQ2 and SEQUENCES is non-nil."
  (cl-do* ((sequences `(,seq1 ,seq2 ,@sequences) (cdr sequences))
           (seq (car sequences) (car sequences))
           (elements (make-hash-table :test #'equal))
           (intersect-p nil))
      ((or (seq-empty-p sequences)) intersect-p)
    (cl-do* ((seq seq (cdr seq))
             (element (car seq) (car seq)))
        ((or intersect-p (seq-empty-p seq)) intersect-p)
      (if (ht-get elements element)
          (setf intersect-p t)
        (ht-set elements element t)))))

(defun test-seq-intersect-p ()
  "Test cases."
  (cl-assert (null (seq-intersect-p '()
                                    '())))
  (cl-assert (null (seq-intersect-p '(1)
                                    '())))
  (cl-assert (null (seq-intersect-p '(1 2)
                                    '(3 4)
                                    '(5 6))))
  (cl-assert (seq-intersect-p '(1 2)
                              '(3 4)
                              '(5 6)
                              '(1)))
  t)

(test-seq-intersect-p)
109
 
 

I am asking for learning purposes. I don't fully understand what Emacs does with sound either, but is there a logical reason why it still uses Alsa and not Pipewire?

110
8
Minimal Emacs? (lemmy.blahaj.zone)
submitted 2 years ago* (last edited 2 years ago) by moonsnotreal@lemmy.blahaj.zone to c/emacs@lemmy.ml
 
 

I have been using vim for forever and I have dabbled in using emacs throughout the years. Emacs with the evil mode bindings is very comfortable, and I prefer org-mode over markdown (at least for the type of notes I do).

The main thing that stops me from using emacs though is how bloated it is. I don't want the games, web browser, email client, etc. Is there a way to remove those features from a standard install or from source?

Edit: I guess I'll stick with vim for now. It looks like Neovim might be more what I'm looking for instead of Emacs

111
 
 

As part of building an emacs local CI (ELCI lol) for myself, I've setup some tooling others might find interesting.

This page generates a commit in near-real-time, updated when someone pushes to emacs.git on savannah: https://u.bru.st/?#emacs-dev

You can get a single property like this: https://u.bru.st/last-rev.pl/?project=emacs&property=revision

Finally, you can also view the raw JSONL FIFO used by last-rev.pl: https://u.bru.st/emacs.jsonl

Sources should be all, or very nearly all, somewhere on my sr.ht GPL or APGL licensed but I'm afraid I've lots to do shifting things around so they make much sense from "the outside". Trying to setup all of this just from sources and my notes so far is probably not great fun. https://git.sr.ht/~mplscorwin/

FTR, this is very brittle; please be gentle in your experimentation and do shout if you see something I might should fix. Same handle on libera.chat IRC is the fastest way to reach me when I'm reachable.

112
113
 
 

Hi guys.

So I figured out I should try to work with Codeium on emacs for a while. See how I like it and if I feel I need it. Seemingly this is easy. Codeium.el say that I should just clone into the repo and add it to my init file. Right? Wrong. I'm clearly doing something wrong. Since no matter what I do I cannot run the m-x codeium-install part. I only get "no match" output.

I've tried to place the (add-to-list 'load-path "~/.emacs.d/codeium.el") both in the ~/.emacs and the ~/.emacs.d/init.el file with no success. I also tried renaming the codeium.el library to be just codeium (and updating the init file) still with no luck.

So what am I doing wrong here? This should be simple to do, I'm sure of it.

114
115
 
 

Here's my config

(use-package general
  :demand t
  :config
  (general-create-definer my/leader-keys
    :keymaps '(normal insert visual emacs)
    :prefix "SPC"
    :global-prefix "C-SPC")
  (my/leader-keys
    ;; Eval
    "ee" 'eval-last-sexp
    "eb" 'eval-buffer) 
  (my/leader-keys 'normal org-mode-map
    "''" 'org-edit-special)
  (my/leader-keys 'normal org-src-mode-map
    "''" 'org-edit-src-exit
    "'k" 'org-edit-src-abort))

Keybinding defined for org-edit-special works fine in org mode. But, when I'm in org src buffer I can't use keybinding for org-edit-src-exit until I go to insert mode an come back. I've also discovered that calling describe key on C-c ', which is default keybinding for that, also works. I'm very confused about this. Can it be a bug or I'm doing something wrong? Thanks in advance for your help.

116
 
 

After I restarted my Emacs daemon (after a couple of months uptime), I started getting plenty of errors like below during the initialisation and most of my keys stopped working:

Key sequence C-c [...] starts with non-prefix key C-c

A quick search indicated that error means the "non-prefix key" is already used. In my case, it was C-c which sounded quite weird.

I ran ag on ~/.emacs.d & luckily was able to find the culprit after a few minutes.

I had this somewhere in my init files:

(global-set-key (kbd "C-c 
s a") #'avy-goto-char-2)

Note the newline after C-c - I must have pressed ENTER by mistake and saved the file w/o paying attention.

I thought I'd share this as this may save some fellow Emacs denizens a few minutes confusing minutes.

My immediate reaction was to blame it on the upgrade to 29.1 🤦‍♂️ The morale of the story is find the blame w/i and not in Emacs!

117
118
11
SQL in Org-Mode (willschenk.com)
submitted 2 years ago by overflow64@lemmy.ml to c/emacs@lemmy.ml
119
 
 

I developed a patcher to allow Pylance to run outside of VS Code again, standalone. You can combine that with a code snippet from the lsp-mode issue tracker to integrate Pylance into Emacs. The patcher is so trivial under the hood that you can do it by hand if you prefer it that way, assuming a bit of JavaScript knowledge.

120
 
 

Huh? Is there an @emacs setting to get format=flowed?

https://useplaintext.email/

121
122
123
 
 

Is there a way to configure Emacs to lock certain files/buffers to specific tabs? For example, if I want all ERC buffers to stay in the ERC tab, or a selected set of org files to stay in the Org tab, etc.

124
 
 

evil-textobj-tree-sitter is a project that provides additional textobjects by using tree-sitter. Link: https://github.com/meain/evil-textobj-tree-sitter


Hey everyone! Since we have tree-sitter now built into Emacs in the newer versions, I've updated evil-texobj-tree-sitter to work with the builtin treesit package. The queries are not as complete the implementation using elisp-tree-sitter, but should cover most of the common usecases. You can find more information in https://github.com/meain/evil-textobj-tree-sitter/pull/93

Removing hard dependency on evil-mode was one other most upvoded issue on the project and so I have added integration with thing-at-point for use without evil-mode. This happen a little while ago, but thought I would add it as well in this update.

125
view more: ‹ prev next ›