0

I managed to insert a template to certain sripts with autocomplete.

Example:

(auto-insert-mode)
(setq auto-insert-query nil)
(setq auto-insert-alist
  '(((ess-mode . "R script") nil
     "# R script " \n
     "# file: " (file-name-nondirectory buffer-file-name) "\n"
       "# Description: " _ "\n\n")))

However, when creating a new file, the buffer-tab is now not selected as with "visit new file". Meaning, that the selected buffer remains selected. Can this behaviour be altered?

Admittedly, it is a minor problem, yet annyoing. Any help would be appreciated.

1 Answer 1

1

I don't know why, but now it works as expected. Must have been some error before. This is the working version:

(auto-insert-mode)
(setq auto-insert-query nil)
(setq auto-insert-alist
      '(((ess-mode . "R script") nil
         "# R script " \n
         "# File: " (file-name-nondirectory buffer-file-name) "\n"
         "# Author: me " \n
         "# Contact: [email protected]" \n
         "# Date: " (format-time-string "%e.%m.%Y") "\n"
         "# Copyright (C) " (substring (current-time-string) -4) "\n"
         "# Description: "  "\n\n")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.