1

I use multiple cursors and I use org-mode extensively though the two together does not work.

This buffer is in fundamental-mode

this is the first line
this is the second line

I'm going to put point amd mark around these two lines and invoke mc/edit-ends-of-lines by hitting it's bound key and type "with an ending"

Now the buffer looks like this

This buffer is in fundamental-mode

this is the first line with an ending
this is the second line with an ending

Now i'm going to put the buffer in org-mode. It now looks like this:

this is the first line
this is the second line

I'm going to put point amd mark around these two lines and invoke mc/edit-ends-of-lines by hitting it's bound key and type "with an ending"

this is the first line
this is the second line with an ending

the cursor appears at the end of both lines, and new characters only appear on the last of the cursors. The Multiple Cursors github page is fairly clear that opening issues/asking them to fix it for me is not desired (which is completely fine, and I greatly respect that).

Is this expected to work, or is there some known issue around this that i should be googling for?


here are the relevant snippest from my init.el file, the whole of which can be found here: https://github.com/thearthur/arthur-s-emacs-config/blob/master/init.el#L370

(use-package multiple-cursors
  :ensure t
  :config
  (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
  (global-set-key (kbd "C-S-w C-S-w") 'mc/mark-all-dwim)
  (global-set-key (kbd "C-S-e C-S-e") 'mc/edit-ends-of-lines)
  (global-set-key (kbd "C->") 'mc/mark-next-like-this)
  (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
  (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))

...

(use-package org
  :ensure t
  :commands org-mode
  :config
  (defun org-summary-todo (n-done n-not-done)
    "Switch entry to DONE when all subentries are done, to TODO otherwise."
    (let (org-log-done org-log-states)   ; turn off logging
      (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  (define-key org-mode-map (kbd "C-c SPC") 'ace-jump-mode)
  (setq org-agenda-files (list "~/ownCloud/org/log.org.gpg"))
  ;; make source code in org-mode files look pretty
  (setq org-src-fontify-natively t)
  (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  (add-hook 'org-mode-hook 'org-indent-home)
  (setq org-hide-leading-stars t)
  (setq org-startup-truncated nil)
  (setq org-log-done 'time)
  (setq org-tags-column (- 4 (window-width)))
  (add-hook 'org-mode-hook 'flyspell-mode)
  (add-hook 'org-mode-hook #'maybe-git-auto-commit-mode)
  (require 'org-crypt)
  (org-crypt-use-before-save-magic)
  (setq org-tags-exclude-from-inheritance (quote ("crypt")))
  ;; GPG key to use for encryption
  ;; Either the Key ID or set to nil to use symmetric encryption.
  (setq org-crypt-key "A20F3E34E472C3BB")
  (define-key org-mode-map (kbd "C-M-s-d") 'org-decrypt-entry))

...

(use-package org-bullets
  :ensure t
  :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
  • Is there a way to rephrase the question in such a way so that we do not have to use use-package to answer it? I.e., a minimal working example without the use-package library. Also, please specify which version of org-mode you are using .... E.g., Step 1: Open a 26.2 version of Emacs; Step 2: Install the multiple-cursors library by Mr. Sveen that is available on MELPA; Step 3: Evaluate ... in a *scratch* buffer; Step 4: Open a new buffer and ... – lawlist Jul 22 at 23:33
  • Works with emacs -q. It asked me "Do org-self-insert-command for all cursors? (y or n)". Make sure org-self-insert-command is not in mc/cmds-to-run-once. This happens if I answer the prompt above with n. If I answer with y it gets added to mc/cmds-to-run-for-all. – Hubisan Jul 23 at 10:36
  • Following up on what @Hubisan said, the value of the mc/cmds-to-run-once variable is persisted in the file ~/.emacs.d/.mc-lists (or something very similar). You should edit that to remove org-self-insert-command. – Omar Jul 23 at 15:36
  • @Hubisan that was exactly the solution to my problem. I also note that it's mentioned in the instructions. If you make that an answer I can mark it correct because i suspect others will have the same problem – Arthur Ulfeldt Jul 24 at 17:06
4

Multiple cursors asks you for unknown commands if they should be run for for all cursors or not: "Do org-self-insert-command for all cursors? (y or n)". If you answer this prompt with no it will remember your choice and never ask again. Therefore using that command afterwards is not run for all cursors.

See the unknown commands section in the readme:

Multiple-cursors uses two lists of commands to know what to do: the run-once list and the run-for-all list. It comes with a set of defaults, but it would be beyond silly to try and include all the known Emacs commands.

So that's why multiple-cursors occasionally asks what to do about a command. It will then remember your choice by saving it in ~/.emacs.d/.mc-lists.el. You can change the location with:

(setq mc/list-file "/my/preferred/file")

NB! Make sure to do so before requiring multiple-cursors.

It is possible to set multiple-cursors to "run-for-all" for every command except for those that are listed in mc/cmds-to-run-once. To enable this set mc/always-run-for-all to non-nil. Add commands to be run once to mc/cmds-to-run-once in ".mc-lists.el".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.