小编SFb*_*007的帖子

使用"next-error"和"previous-error"循环显示结果

我使用"next-error"和"previous-error"来循环结果.但是一旦到达最后一个条目,循环就不会回到顶部,依此类推.

有没有办法让自行车一旦到达底部继续上升,反之亦然?

emacs elisp

2
推荐指数
1
解决办法
1437
查看次数

查找项目中文件的相对路径

我的项目文件以这种格式设置:

/home/user/proj/source
/home/user/proj/source/src1
/home/user/proj/source/src1
/home/user/proj/header ...etc
Run Code Online (Sandbox Code Playgroud)

我有办法在查看任何源文件时找到项目路径

"/home/user/proj"
Run Code Online (Sandbox Code Playgroud)

此外,(buffer-file-name)给出给定源文件的完整绝对路径.

如何编写一个提取源文件相对路径的lisp函数?

意思是,如果我正在观看

/home/user/proj/source/src1/file.c
Run Code Online (Sandbox Code Playgroud)

我想有这条路

"source/src1/file.c"
Run Code Online (Sandbox Code Playgroud)

以下函数为我提供了项目路径:

(defun upward-find-file (filename &optional startdir)
  (let ((dirname (expand-file-name
          (if startdir startdir ".")))
    (found nil) ; found is set as a flag to leave loop if we find it
    (top nil))  ; top is set when we get
            ; to / so that we only check it once
    ; While we've neither been at the top last time nor have we found
    ; the file.
    (while …
Run Code Online (Sandbox Code Playgroud)

emacs elisp

1
推荐指数
1
解决办法
740
查看次数

找到当前路径的深度

如何编写shell脚本来查找当前路径的深度?

假设我在:

/home/user/test/test1/test2/test3
Run Code Online (Sandbox Code Playgroud)

它应该返回6.

unix linux bash shell fish

1
推荐指数
2
解决办法
774
查看次数

将预处理器指令作为语句的一部分

我们转到了新的编译环境,突然间我开始在此语句上看到此错误“期望的表达式”:

enum {
  PROJX,
  PROJY,
  PROJW
};

constexpr int PLATFORM =
#if defined(X)
  PROJX
#elif defined(Y)
  PROJY 
#elif defined(W)
  PROJW
#endif
  ;
Run Code Online (Sandbox Code Playgroud)

错误指向最后一个分号。

这与特定的c ++ 11/14/17标准有关吗?

c++ c-preprocessor constexpr c++11

-1
推荐指数
1
解决办法
59
查看次数

标签 统计

elisp ×2

emacs ×2

bash ×1

c++ ×1

c++11 ×1

c-preprocessor ×1

constexpr ×1

fish ×1

linux ×1

shell ×1

unix ×1