phillord / lentic

Create views of the same content in two Emacs buffers
183 stars 12 forks source link

`lentic-mode-insert-file-local' use `add-file-local-variable' ? #15

Closed tumashu closed 9 years ago

tumashu commented 9 years ago
(defun lentic-mode-insert-file-local (init-function)
  (interactive
   (list (completing-read
          "Lentic init function: "
          (mapcar
           'symbol-name
           lentic-init-functions)
          'identity 'confirm)))
  (save-excursion
    (goto-char (point-max))
    (let ((start (point)))
      (insert
       (format
        ;; split this string or we get local variable not terminated properly
        ;; errors.
        (concat "\nLocal"
                " Variables:\nlentic-init: %s\nEnd:\n") init-function))
      (comment-region start (point)))))

I think it is too hack, is it possible to use `add-file-local-variable' ?

phillord commented 9 years ago

Yes. I didn't know about `add-file-local-variable' when I wrote it.