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.

0

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: my@email.mail" \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, privacy policy and cookie policy

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