From: j8takagi <j8takagi@nifty.com> Date: Wed, 20 Feb 2013 14:27:34 +0000 (+0900) Subject: コメントの修正、プログラムの推敲 X-Git-Url: https://www.j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=HEAD;p=exopen-mode.git コメントの修正、プログラムの推敲 --- diff --git a/exopen-mode.el b/exopen-mode.el index 46aa2f1..3b74f8b 100644 --- a/exopen-mode.el +++ b/exopen-mode.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2013 j8takagi ;; Author: j8takagi <j8takagi@nifty.com> -;; Keywords: Emacs å¤é¨ããã°ã©ã +;; Keywords: Emacs external program å¤é¨ããã°ã©ã ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ ;;; Commentary: -;; Emacsããã®å¤é¨ããã°ã©ã å¼ã³åºããæ¯æ´ãããã¤ãã¼ã¢ã¼ãã§ãã +;; Emacsããã®å¤é¨ããã°ã©ã å¼ã³åºããæ¯æ´ãããã¤ãã¼ã¢ã¼ãã ;; â åä½ç°å¢ ;; LinuxãMac OS XãWindowsã®ããããã®Windowã·ã¹ãã ä¸ @@ -37,18 +37,23 @@ ;; Windowã·ã¹ãã ä¸ã§Emacsãåä½ãã¦ããå ´åãexopen-mode ã¯èªåçã«æå¹ã«ãªãã¾ãã ;; ;; â ä½¿ãæ¹ - +;; exopen-modeãæå¹ãªå ´åãæ¬¡ã®é¢æ°ã使ããã¨ãã§ãã¾ãã +;; +;; exopen-file (file) å¤é¨ãã¡ã¤ã«ãå¼ã³åºã +;; æ¨æºã§ãC-x C-M-fã«ãã¤ã³ã ;; â hook ;; ãã¤ãã¼ã¢ã¼ãã®å®ç¾© - (easy-mmode-define-minor-mode exopen-mode - "minor mode for opening fle in external program." - ;; åæå¤ -(display-graphic-p) - ;; ã¢ã¼ãè¡ã®è¡¨ç¤º - "" - ;; ãã¤ãã¼ã¢ã¼ãç¨ãã¼ãããã®åæå¤ - '(("\C-x\C-\M-f" . exopen-find-file))) +(define-minor-mode exopen-mode +"Toggle exopen-mode. +With a prefix argument ARG, enable Auto Composition mode if ARG +is positive, and disable it otherwise. If called from Lisp, +enable the mode if ARG is omitted or nil. + +open file in external program." +(display-graphic-p) ; Windowã·ã¹ãã ãã©ããã®å¤å® +nil ; ã¢ã¼ãè¡ã«ä½ã表示ããªã +'(("\C-x\C-\M-f" . exopen-find-file))) ; ãã¼ãã¤ã³ã ;; exopen-std-cmd: OSãWindowã§è¨å®ãããé¢é£ä»ãããã¨ã« ;; ãã¡ã¤ã«ãéãããã°ã©ã ã³ãã³ã @@ -71,10 +76,12 @@ (let ((process-connection-type nil) (cmd)) (if exopen-suffix-cmd (setq cmd (cdr(assoc (file-name-extension file 1) exopen-suffix-cmd)))) - (if (null cmd) + (unless cmd (setq cmd exopen-std-cmd)) (start-process "exopen" nil cmd file) - (message (concat "exopen: " cmd " " file " at " (format-time-string "%Y/%m/%d %H:%M:%S" (current-time)))))) + (message + (concat "exopen: " cmd " " file " at " + (format-time-string "%Y/%m/%d %H:%M:%S" (current-time)))))) ;;; ãããã¡ã§éãã¦ãããã¡ã¤ã«ãå¤é¨ããã°ã©ã ã§ãªã¼ãã³ (defun exopen-buffer-file () @@ -88,7 +95,7 @@ (defun exopen-buffer-file-suffix (suffix) "open buffer file of other extension in external program" (let (afile) - (if (not buffer-file-name) + (unless buffer-file-name (error "This buffer is not visiting a file")) (setq afile (concat (file-name-sans-extension (buffer-file-name)) suffix)) (if (file-exists-p afile) @@ -119,7 +126,7 @@ "open buffer file or find-file in external program" (interactive "P") (let ((afile)) - (if (null find-or-buffer) + (unless find-or-buffer (progn (setq afile (expand-file-name (read-file-name "Find external open file: " buffer-file-name)))