LINUX.ORG.RU

История изменений

Исправление Bad_ptr, (текущая версия) :

(defvar emacs-files-to-find-file-name "/tmp/emacs-files-to-find")
(defvar emacs-files-to-find-buffer (or (find-buffer-visiting emacs-files-to-find-file-name)
                                       (with-current-buffer (find-file-noselect emacs-files-to-find-file-name)
                                         (save-buffer)
                                         (rename-buffer " *emacs-files-to-find-buf*")
                                         (current-buffer))))

(defun find-files-from-buffer-and-erase (buffer-or-name)
  (let ((files (split-string
                (with-current-buffer buffer-or-name
                  (let ((ret (buffer-string)))
                    (erase-buffer)
                    ret))
                "\n" t "[ \t\n]")))
    (mapc #'find-file files)))

(with-current-buffer emacs-files-to-find-buffer
  (add-hook 'after-revert-hook
            #'(lambda ()
                (find-files-from-buffer-and-erase emacs-files-to-find-buffer))
            nil t)
  (auto-revert-mode))


#!/bin/bash
echo "$1" >> /tmp/emacs-files-to-find

Исходная версия Bad_ptr, :

рабочая версия 1.0

(defvar emacs-files-to-find-file-name "/tmp/emacs-files-to-find")
(defvar emacs-files-to-find-buffer (or (find-buffer-visiting emacs-files-to-find-file-name)
                                       (with-current-buffer (find-file-noselect emacs-files-to-find-file-name)
                                         (save-buffer)
                                         (rename-buffer " *emacs-files-to-find-buf*")
                                         (current-buffer))))

(defun find-files-from-buffer-and-erase (buffer-or-name)
  (let ((files (split-string
                (with-current-buffer buffer-or-name
                  (let ((ret (buffer-string)))
                    (erase-buffer)
                    ret))
                "\n" t "[ \t\n]")))
    (mapc #'find-file files)))

(with-current-buffer emacs-files-to-find-buffer
  (add-hook 'after-revert-hook
            #'(lambda ()
                (find-files-from-buffer-and-erase emacs-files-to-find-buffer))
            nil t)
  (auto-revert-mode))


#!/bin/bash
echo "$1\" >> /tmp/emacs-files-to-find