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 中的缓冲区数

emacs - emacs中的perl样式正则表达式

c++ - 在 emacs 中设置断点时隐藏源缓冲区

emacs - 在 Windows 8.1 上启动时最大化 GNU Emacs

emacs - 在特定模式下设置变量emacs

emacs - 在退出全屏时在 Emacs 中设置帧大小

loops - emacs 覆盖在循环中创建时自动合并

Emacs:符号作为变量的值是无效的:custom-theme-load-path

emacs - 在 emacs 中,如何仅突出显示当前帧中的当前行?

emacs - 将 Unicode (UTF-8) 代码点转换为字节