以编程方式进行班次选择

时间:2016-08-12 07:50:19

标签: emacs selection shift

给定一个起始位置(b)和一个结束位置(e),我想通过从b到e点击movement keys with shift来执行相同的操作,但是在elisp中。可以通过任何移动键取消选择而不移位,因此set-mark-command不是我想要的。

1 个答案:

答案 0 :(得分:2)

您可以尝试:

(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)))

此代码主要取自handle-shift-selection

相关问题