以编程方式进行轮班选择
Programmatically do shift selection
给定开始位置 (b) 和结束位置 (e),我想要执行与点击 movement keys with shift from b to e, but in elisp. The selection can be cancelled by any movement key without shift, so set-mark-command 相同的动作,这不是我想要的。
你可以试试:
(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
。
给定开始位置 (b) 和结束位置 (e),我想要执行与点击 movement keys with shift from b to e, but in elisp. The selection can be cancelled by any movement key without shift, so set-mark-command 相同的动作,这不是我想要的。
你可以试试:
(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
。