Suprimir prompt para salvar o arquivo no emacs com recompilação

3

Eu geralmente configuro um comando de compilação não trivial e, em seguida, freqüentemente chamo 'recompile . Existe uma maneira de suprimir o prompt para salvar arquivos semelhantes à abordagem em auctex invocada com (setq TeX-save-query nil) ? Eu acho muito chato ter sempre que salvar manualmente, ou pressione y no prompt. Quando eu clicar em recompilar, quero que todos os arquivos sejam salvos, se necessário.

    
por Fred Schoen 19.08.2014 / 09:20

1 resposta

3
compilation-ask-about-save is a variable defined in 'compile.el'.
Its value is t

Documentation:
Non-nil means M-x compile asks which buffers to save before compiling.
Otherwise, it saves all modified buffers without asking.

You can customize this variable.

Aqui está a função recompile , que demonstra que também usa a variável compilation-ask-about-save :

  
(defun recompile (&optional edit-command)
  "Re-compile the program including the current buffer.
If this is run in a Compilation mode buffer, re-use the arguments from the
original use.  Otherwise, recompile using 'compile-command'.
If the optional argument 'edit-command' is non-nil, the command can be edited."
  (interactive "P")
  (save-some-buffers (not compilation-ask-about-save)
                     compilation-save-buffers-predicate)
  (let ((default-directory (or compilation-directory default-directory))
    (command (eval compile-command)))
    (when edit-command
      (setq command (compilation-read-command (or (car compilation-arguments)
                          command)))
      (if compilation-arguments (setcar compilation-arguments command)))
    (apply 'compilation-start (or compilation-arguments (list command)))))

Veja também o doc-string para save-some-buffers - " Argumento opcional (o prefixo) não-nulo significa salvar tudo sem perguntas. "

save-some-buffers is an interactive compiled Lisp function in
'files.el'.

It is bound to C-x s.

(save-some-buffers &optional ARG PRED)

Save some modified file-visiting buffers.  Asks user about each one.
You can answer 'y' to save, 'n' not to save, 'C-r' to look at the
buffer in question with 'view-buffer' before deciding or 'd' to
view the differences using 'diff-buffer-with-file'.

This command first saves any buffers where 'buffer-save-without-query' is
non-nil, without asking.

Optional argument (the prefix) non-nil means save all with no questions.
Optional second argument PRED determines which buffers are considered:
If PRED is nil, all the file-visiting buffers are considered.
If PRED is t, then certain non-file buffers will also be considered.
If PRED is a zero-argument function, it indicates for each buffer whether
to consider it or not when called with that buffer current.

See 'save-some-buffers-action-alist' if you want to
change the additional actions you can take on files.
    
por 19.08.2014 / 17:47

Tags