Changeset 556 for lang/elisp

Show
Ignore:
Timestamp:
10/19/07 20:11:38 (6 years ago)
Author:
kentaro
Message:

lang/elisp/simple-hatena-mode: When password is empty in config file, show prompt to let user input it. Patch from http://d.hatena.ne.jp/odz/20071019/1192781973

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/elisp/simple-hatena-mode/simple-hatena-mode.el

    r526 r556  
    3838;;;; * ヴァージョン 
    3939 
    40 (defconst simple-hatena-version "0.08" 
     40(defconst simple-hatena-version "0.09" 
    4141  "simple-hatena-mode.elのヴァージョン。") 
    4242 
     
    111111 
    112112実行時に、-cオプションとして使われる。") 
     113 
     114(defcustom simple-hatena-process-buffer-name "*SimpleHatena*" 
     115  "はてダラを実行するプロセスのバッファ名。" 
     116  :type 'string 
     117  :group 'simple-hatena) 
    113118 
    114119;; キーバインド 
     
    469474      (save-buffer)) 
    470475    (message "%s" "Now posting...") 
    471     (shell-command (simple-hatena-internal-build-command flag) 
    472                    "*SimpleHatenaOutput*" "*SimpleHatenaError*") 
    473     (run-hooks 'simple-hatena-after-submit-hook))) 
     476    (let* ((buffer (get-buffer-create simple-hatena-process-buffer-name)) 
     477           (proc (get-buffer-process buffer))) 
     478      (if (and 
     479           proc 
     480           (eq (process-status proc) 'run) 
     481           (yes-or-no-p (format "A %s process is running; kill it?" 
     482                                (process-name proc)))) 
     483          (progn 
     484            (interrupt-process proc) 
     485            (sit-for 1) 
     486            (delete-process proc))) 
     487      (with-current-buffer buffer 
     488        (progn 
     489          (erase-buffer) 
     490          (buffer-disable-undo (current-buffer)))) 
     491      (make-comint-in-buffer 
     492       "simple-hatena-submit" buffer shell-file-name nil 
     493       shell-command-switch (simple-hatena-internal-build-command flag)) 
     494      (set-process-sentinel 
     495       (get-buffer-process buffer) 
     496       '(lambda (process signal) 
     497          (if (string= signal "finished\n") 
     498              (let ((max-mini-window-height 10)) 
     499                (display-message-or-buffer (process-buffer process)) 
     500                (run-hooks 'simple-hatena-after-submit-hook)))))))) 
    474501 
    475502(defun simple-hatena-internal-build-command (flag)