Emacs 以编程方式进行轮班选择

Emacs 以编程方式进行轮班选择,emacs,selection,shift,Emacs,Selection,Shift,给定一个起始位置(b)和一个结束位置(e),我想执行与从b到e的相同的动作,但在elisp中。任何移动键都可以取消选择,无需shift,因此这不是我想要的。您可以尝试: (defun my-mark-region-as-shifted (other-end) (let ((pos (point))) (goto-char other-end) (setq-local transient-mark-mode (cons 'only

给定一个起始位置(b)和一个结束位置(e),我想执行与从b到e的相同的动作,但在elisp中。任何移动键都可以取消选择,无需shift,因此这不是我想要的。

您可以尝试:

(defun my-mark-region-as-shifted (other-end)
  (let ((pos (point)))
    (goto-char other-end)
    (setq-local transient-mark-mode
                (cons 'only
                      (unless (eq transient-mark-mode 'lambda)
                        transient-mark-mode)))
    (push-mark nil nil t)
    (goto-char pos)))

此代码主要来自
手柄移位选择

这在批处理环境中不起作用,但在常规环境中起作用