【问题标题】:Navigating file using helm使用 helm 导航文件
【发布时间】:2014-09-14 14:50:52
【问题描述】:

我正在尝试使用 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}

【问题讨论】:

    标签: regex emacs emacs-helm


    【解决方案1】:
    1. 您可能希望 "^\\\\s.*\\|^\\\\f.*" 或至少 "^\\\\s\\|^\\\\f" 作为您的正则表达式。见(elisp) Syntax for Strings(elisp) Regexp Backslash 关于 Lisp 中的反斜杠。

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

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

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

    【讨论】:

      猜你喜欢
      • 2020-04-15
      • 2019-08-03
      • 2016-04-23
      • 1970-01-01
      • 2022-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多