emacs - 如何避免 |...| 中的换行符在 Emacs 中

标签 emacs

在 Emacs 中,如何避免 |...| 中的换行符当使用 M-q(填充段落)时?

https://groups.google.com/forum/?fromgroups#!searchin/gnu.emacs.help/fill-nobreak-predicate/gnu.emacs.help/qNuZZjQnsww/99oJ1fb4OSUJ我找到了 [[...]] 的以下解决方案,但当打开和关闭分隔符相同时它不起作用:

(defun fill-open-link-nobreak-p ()
  "Don't break a line after an unclosed \"[[link \"."
  (save-excursion
    (skip-chars-backward " ")
    (let ((opoint (point))
          spoint inside)
      (save-excursion
        (beginning-of-line)
        (setq spoint (point)))
       (when (re-search-backward "\\[\\[" spoint t)
        ;; (message "found") (sit-for 2)
        (unless (re-search-forward "\\]\\]" opoint t)
          (setq inside t)))
      inside)))

(add-to-list 'fill-nobreak-predicate 'fill-open-link-nobreak-p)

最佳答案

这似乎可以解决问题:

(defun odd-number-of-pipes-this-paragraph-so-far ()
  (oddp (how-many "|" (save-excursion (backward-paragraph) (point)) (point))))

(add-to-list 'fill-nobreak-predicate 'odd-number-of-pipes-this-paragraph-so-far)

关于emacs - 如何避免 |...| 中的换行符在 Emacs 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13915400/

相关文章:

emacs - 在 Emacs 中打开特定文件的快捷方式

shell - Emacs 和长 Shell 命令

emacs - 如何使任何 emacs 缓冲区中的组织语法链接看起来像组织模式?

linux - valgrind vgdb 与 emacs 中的 gdb

emacs - 在组织模式下将CREATED date属性添加到TODO

javascript - Flymake 在加载 js2-mode 后立即退出

emacs - 如何使 Emacs(无 GUI)区分 Ctrl+Shift+S 和 Ctrl+S?

javascript - 如何阻止 emacs 缩进 javascript 逗号分隔列表(例如数组或 json)的第二行?

javascript - 在 Emacs 中使用 js2 模式正确缩进缓冲区

python - emacs-jedi 没有找到 numpy 完成