| @@ -1132,25 +1132,27 @@ if arg is omitted use value of `buffer-list'." | |||||
| (let* ((dir-default (dired-dwim-target-directory)) | (let* ((dir-default (dired-dwim-target-directory)) | ||||
| (archive-default (my-pack-file-extension (file-name-nondirectory (car infiles)))) | (archive-default (my-pack-file-extension (file-name-nondirectory (car infiles)))) | ||||
| (archive ;; (if (interactive-p) | (archive ;; (if (interactive-p) | ||||
| (read-file-name "Output file to pack : " ;; (format "Output file to pack (default for %s) : " | |||||
| ;; archive-default) | |||||
| (read-file-name "Output file to pack : " | |||||
| dir-default | dir-default | ||||
| nil ;; archive-default | |||||
| nil | |||||
| nil | nil | ||||
| archive-default) | archive-default) | ||||
| ;; (concat dir-default archive-default) | ;; (concat dir-default archive-default) | ||||
| ))) | |||||
| (apply 'my-pack | |||||
| archive | |||||
| infiles))) | |||||
| )) | |||||
| (apply 'my-pack | |||||
| archive | |||||
| infiles)))) | |||||
| (revert-buffer) | (revert-buffer) | ||||
| ;; (dired-unmark-all-marks) | ;; (dired-unmark-all-marks) | ||||
| ) | ) | ||||
| (defun my-pack-file-name-association (filename) | (defun my-pack-file-name-association (filename) | ||||
| "" | "" | ||||
| (assoc (my-file-name-extension-with-tar filename) | |||||
| my-pack-program-alist)) | |||||
| (let ((case-fold-search nil)) | |||||
| (assoc-default filename | |||||
| my-pack-program-alist | |||||
| 'string-match-p | |||||
| nil))) | |||||
| (defun my-file-name-extension-with-tar (filename) | (defun my-file-name-extension-with-tar (filename) | ||||
| "if FILENAME has extension with tar, like \"tar.gz\", return that. | "if FILENAME has extension with tar, like \"tar.gz\", return that. | ||||
| @@ -1170,42 +1172,42 @@ otherwise, return FILENAME with `my-pack-default-extension'" | |||||
| (defvar my-7z-program-name | (defvar my-7z-program-name | ||||
| (or (executable-find "7z") | (or (executable-find "7z") | ||||
| (executable-find "7za") | (executable-find "7za") | ||||
| (executable-find "7zr"))) | |||||
| (executable-find "7zr")) | |||||
| "path to 7z program.") | |||||
| (defvar my-pack-default-extension | (defvar my-pack-default-extension | ||||
| "7z") | |||||
| "7z" | |||||
| "default suffix for packing. filename with this suffix must matches `pack-program-alist'") | |||||
| (defvar my-pack-program-alist | (defvar my-pack-program-alist | ||||
| (list (list "7z" (concat my-7z-program-name " a") (concat my-7z-program-name " x")) | |||||
| '("tar" "tar cf" "tar xf") | |||||
| '("tgz" "tar czf" "tar xzf") | |||||
| '("txz" "tar cJf" "tar xJf") | |||||
| '("zip" "zip -r" "unzip"))) | |||||
| (string-match-p "\\.gz\\'" "aaa.gz") ; \' matches string end, $ may match the point before newline. | |||||
| ;; (case-fold-search nil) | |||||
| `(("\\.7z\\'" ,(concat my-7z-program-name " a"), (concat my-7z-program-name " x")) | |||||
| ("\\.tar\\'" "tar cf" "tar xf") | |||||
| ("\\.tgz\\'" "tar czf" "tar xzf") | |||||
| ("\\.zip\\'" "zip -r" "unzip"))) | |||||
| ;; (string-match-p "\\.gz\\'" "aaa.gz") ; \' matches string end, $ also matches the point before newline. | |||||
| (defun my-unpack (archive) | (defun my-unpack (archive) | ||||
| "" | |||||
| "unpack ARCHIVE. command for unpacking is defined in `pack-program-alist'" | |||||
| (interactive "fArchive to extract: ") | (interactive "fArchive to extract: ") | ||||
| (let* ((earchive (expand-file-name archive)) | (let* ((earchive (expand-file-name archive)) | ||||
| (lst (my-pack-file-name-association earchive)) | (lst (my-pack-file-name-association earchive)) | ||||
| ) | ) | ||||
| (if lst | (if lst | ||||
| (shell-command (concat (nth 2 | |||||
| (shell-command (concat (nth 1 | |||||
| lst) | lst) | ||||
| " " | " " | ||||
| (shell-quote-argument earchive))) | (shell-quote-argument earchive))) | ||||
| (message "this is not archive file defined in `pack-program-alist'!")))) | (message "this is not archive file defined in `pack-program-alist'!")))) | ||||
| (defun my-pack (archive &rest files) | (defun my-pack (archive &rest files) | ||||
| "pack files FILES into file ARCHIVE. | |||||
| "pack FILES into ARCHIVE. | |||||
| if ARCHIVE have extension defined in `pack-program-alist', use that command. | if ARCHIVE have extension defined in `pack-program-alist', use that command. | ||||
| otherwise, use `pack-default-extension'. for pack." | |||||
| otherwise, use `pack-default-extension' for pack." | |||||
| (let* ((archive-ext (my-pack-file-extension (expand-file-name archive))) | (let* ((archive-ext (my-pack-file-extension (expand-file-name archive))) | ||||
| (lst (my-pack-file-name-association archive-ext)) | (lst (my-pack-file-name-association archive-ext)) | ||||
| ) | ) | ||||
| (if lst | (if lst | ||||
| (shell-command (concat (nth 1 lst) | |||||
| (shell-command (concat (nth 0 lst) | |||||
| " " | " " | ||||
| (shell-quote-argument archive-ext) | (shell-quote-argument archive-ext) | ||||
| " " | " " | ||||
| @@ -1216,7 +1218,7 @@ otherwise, use `pack-default-extension'. for pack." | |||||
| (defun my-pop-to-buffer-erase-noselect (buffer-or-name) | (defun my-pop-to-buffer-erase-noselect (buffer-or-name) | ||||
| "pop up buffer using `display-buffer' and return that buffer." | "pop up buffer using `display-buffer' and return that buffer." | ||||
| (let ((bf (get-buffer-create buffer-or-name))) | |||||
| (let ((bf (get-buffer-create buffer-or-name))) | |||||
| (with-current-buffer bf | (with-current-buffer bf | ||||
| (cd ".") | (cd ".") | ||||
| (erase-buffer)) | (erase-buffer)) | ||||
| @@ -1584,7 +1586,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." | |||||
| (eshell/export "GIT_EDITOR=") | (eshell/export "GIT_EDITOR=") | ||||
| (eshell/export "LC_MESSAGES=C") | (eshell/export "LC_MESSAGES=C") | ||||
| (eshell/export "TERM=xterm") | (eshell/export "TERM=xterm") | ||||
| )) | |||||
| ))))) | |||||
| ;; (eval-after-load "em-alias" | ;; (eval-after-load "em-alias" | ||||
| ;; '(progn ;; (eshell/alias "ll" "ls -l") | ;; '(progn ;; (eshell/alias "ll" "ls -l") | ||||
| @@ -1848,6 +1850,7 @@ this is test, does not rename files" | |||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
| ;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize | ;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize | ||||
| (define-key my-prefix-map (kbd "C-w") 'my-window-organizer) | (define-key my-prefix-map (kbd "C-w") 'my-window-organizer) | ||||
| (defun my-window-organizer () | (defun my-window-organizer () | ||||
| "Control window size and position." | "Control window size and position." | ||||
| (interactive) | (interactive) | ||||
| @@ -2033,3 +2036,4 @@ this is test, does not rename files" | |||||
| (setq w32-enable-synthesized-fonts t)) | (setq w32-enable-synthesized-fonts t)) | ||||
| (setq file-name-coding-system 'sjis)) | (setq file-name-coding-system 'sjis)) | ||||