在org中用逗号转发句子的部分句子
Forward sentence by comma by partial sentence in org
在调用 org-forward-sentence
的组织中敲击 M-e
,从而将指针移至句子末尾。
我想用逗号移动。当引用 org-forward-sentence
时,请注意
的最后两行
(let ((sentence-end (concat (sentence-end) "\|^\*+ .*$")))
(call-interactively #'forward-sentence)))))))
来自完整的定义。
(defun org-forward-sentence (&optional _arg)
"Go to end of sentence, or end of table field.
This will call `forward-sentence' or `org-table-end-of-field',
depending on context."
(interactive)
(if (and (org-at-heading-p)
(save-restriction (skip-chars-forward " \t") (not (eolp))))
(save-restriction
(narrow-to-region (line-beginning-position) (line-end-position))
(call-interactively #'forward-sentence))
(let* ((element (org-element-at-point))
(contents-end (org-element-property :contents-end element))
(table (org-element-lineage element '(table) t)))
(if (and table
(>= (point) (org-element-property :contents-begin table))
(< (point) contents-end))
(call-interactively #'org-table-end-of-field)
(save-restriction
(when (and contents-end
(> (point-max) contents-end)
;; Skip blank lines between elements.
(< (org-element-property :end element)
(save-excursion (goto-char contents-end)
(skip-chars-forward " \r\t\n"))))
(narrow-to-region (org-element-property :contents-begin element)
contents-end))
;; End of heading is considered as the end of a sentence.
(let ((sentence-end (concat (sentence-end) "\|^\*+ .*$")))
(call-interactively #'forward-sentence)))))))
然后把dot
改成了逗号
(let ((sentence-end (concat (sentence-end) "\|^\*+ ,*$"))) ;;changee . to ,
(call-interactively #'forward-sentence)))))))
然而,事实证明这是错误的。
我应该在原来的功能中更改哪里。
Define it as
(def org-forward-partial-sentence (&optional arg)
and (global-set-key "\C-m"
.
在正则表达式上下文中有特殊含义,请参阅手册中的 (emacs)Regexps。
一个非常简单的修改可以是,
(concat (sentence-end) "\|^\*+ .*$\|,")
也移动到 ,
。
无需更改整个函数,您可以让 sentence-end
围绕 org-forward-sentence
绑定,例如
(defun my-org-forward-sentence ()
(interactive)
(let ((sentence-end (concat (sentence-end) "\|,")))
(call-interactively #'org-forward-sentence)))
在调用 org-forward-sentence
的组织中敲击 M-e
,从而将指针移至句子末尾。
我想用逗号移动。当引用 org-forward-sentence
时,请注意
(let ((sentence-end (concat (sentence-end) "\|^\*+ .*$")))
(call-interactively #'forward-sentence)))))))
来自完整的定义。
(defun org-forward-sentence (&optional _arg)
"Go to end of sentence, or end of table field.
This will call `forward-sentence' or `org-table-end-of-field',
depending on context."
(interactive)
(if (and (org-at-heading-p)
(save-restriction (skip-chars-forward " \t") (not (eolp))))
(save-restriction
(narrow-to-region (line-beginning-position) (line-end-position))
(call-interactively #'forward-sentence))
(let* ((element (org-element-at-point))
(contents-end (org-element-property :contents-end element))
(table (org-element-lineage element '(table) t)))
(if (and table
(>= (point) (org-element-property :contents-begin table))
(< (point) contents-end))
(call-interactively #'org-table-end-of-field)
(save-restriction
(when (and contents-end
(> (point-max) contents-end)
;; Skip blank lines between elements.
(< (org-element-property :end element)
(save-excursion (goto-char contents-end)
(skip-chars-forward " \r\t\n"))))
(narrow-to-region (org-element-property :contents-begin element)
contents-end))
;; End of heading is considered as the end of a sentence.
(let ((sentence-end (concat (sentence-end) "\|^\*+ .*$")))
(call-interactively #'forward-sentence)))))))
然后把dot
改成了逗号
(let ((sentence-end (concat (sentence-end) "\|^\*+ ,*$"))) ;;changee . to ,
(call-interactively #'forward-sentence)))))))
然而,事实证明这是错误的。
我应该在原来的功能中更改哪里。
Define it as
(def org-forward-partial-sentence (&optional arg)
and (global-set-key "\C-m"
.
在正则表达式上下文中有特殊含义,请参阅手册中的 (emacs)Regexps。
一个非常简单的修改可以是,
(concat (sentence-end) "\|^\*+ .*$\|,")
也移动到 ,
。
无需更改整个函数,您可以让 sentence-end
围绕 org-forward-sentence
绑定,例如
(defun my-org-forward-sentence ()
(interactive)
(let ((sentence-end (concat (sentence-end) "\|,")))
(call-interactively #'org-forward-sentence)))