2

我正在尝试使用 helm 设置一个函数来按照以下建议导航投影仪文件:“ http://blog.jenkster.com/2013/10/a-tip-for-navigating-clojure-files-in-emacs .html ”。我试过了:

(defun helm-beamer-headlines ()
  "Display headlines for the current Beamer file."
  (interactive)
  (helm-mode t)
  (helm :sources '(((name . "Beamer Headlines")
                    (volatile)
                    (headline "^\\s\|^\\f")))))

只显示以 \f 和 \s 开头的行(对应于分段和框架命令),虽然 regexp 与 emacs regexp search 和 helm-occur 一起使用,但我没有与M-x helm-beamer-headlines.

我尝试过的最小文件是:

\documentclass{beamer}
\begin{document}
\section{A}
\subsection{Aa}
\frame{\frametitle{}
\begin{enumerate}
\item one
\item two
\end{enumerate}
}
\subsection{Ab}
\frame{\frametitle{}
\begin{align*}
\alpha&=\beta
\end{align*}
}
\section{B}
\subsection{Ba}
\frame{\frametitle{}
\includegraphics[width=\textwidth]{abc.png}
}
\end{document}
4

1 回答 1

1
  1. 您可能想要"^\\\\s.*\\|^\\\\f.*"或至少"^\\\\s\\|^\\\\f"作为您的正则表达式。参见Lisp(elisp) Syntax for Strings(elisp) Regexp Backslash 的反斜杠。

  2. 我不能说你应该为 Helm 使用什么。但作为替代方案,如果您使用Icicles ,这就是您所需要的:

    (defun foo ()
      "..."
      (interactive)
      (icicle-search (point-min) (point-max) "^\\\\s.*\\|^\\\\f.*" t))
    

然后M-x foo TAB在您的投影仪缓冲区中。完成候选是您想要的线条。使用等在它们之间导航。有关更多信息,C-down请参阅Icicles搜索文档。

于 2014-09-15T16:37:26.553 回答