New answers tagged

2

If I understand you properly, you're asking how to automate calling a command with a specific set of arguments. To do this, first take a look at the command in question: C-h f shell-command-on-region: shell-command-on-region is an interactive compiled Lisp function in ‘simple.el’. It is bound to M-|, . (shell-command-on-region START END ...


1

(defun my-filter (start end) (interactive "r") (shell-command-on-region start end "uniq -c" 1 ;; use current buffer 1 ;; replace the text region selected nil t nil))


0

Here is the final elisp function that works. It automatically switches to the window and move the cursor to the bottom . (defun compileandrun() (interactive) (save-buffer) (compile (concat "g++ " (file-name-nondirectory (buffer-file-name)) " -o " (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) " && ./" (file-name-...


1

compile uses the shell. You can chain program execution with && like g++ test.cc -o test && ./test. With the last command ./test is executed if compilation with g++ succeeds. I'll modify your command accordingly: (defun compileandrun() (interactive) (let ((src (file-name-nondirectory (buffer-file-name))) (exe (file-name-sans-...


0

@phils answered the question. This is just to say that the version of find-grep-dired in library find-dired+.el provides a bit more than the vanilla version: It has two optional args, DEPTH-LIMITS and EXCLUDED-PATHS. The interactive spec uses read-from-minibuffer, read-file-name, dired-regexp-history and find-diredp-default-fn. find-grep-dired is an ...


0

The following does that and presents the results as a dired buffer: M-x find-grep-dired You'll also want to know about: M-x rgrep (which doesn't support the -l option to grep, but is usually what I want from a recursive regexp search.)


Top 50 recent answers are included