Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ess-load-file (file-name-nondirectory (buffer-file-name)))
- (defun my-copy-file ()
- (interactive)
- (cond ((equal "home.org" (file-name-nondirectory (buffer-file-name)))
- (write-region (point-min) (point-max)
- (concat "~/org/" (file-name-nondirectory (buffer-file-name)))))))
- (add-hook 'before-save-hook #'my-copy-file)
- ;; /plink:user@my.host.org:/the/remote/path/finename.cc
- (defun my-mirror-remote-file ()
- (interactive)
- ;; first search the at sign `@' in the buffer file name
- (let* ((file_name (buffer-file-name))
- (atpos (string-match "@" file_name)))
- ;; if there is an at sign in the file name, we assume it is a remote file
- (cond (atpos
- ;; we look for the second colon, which is after the host part
- ;; and we get the diretory and file name
- (let* ((hoston (substring file_name atpos))
- (colonpos (string-match ":" hoston)))
- ;; and we write the file locally (it will NOT create the dir though)
- (write-region (point-min) (point-max)
- (concat "~" (substring hoston (+ colonpos 1)))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement