Show
Ignore:
Timestamp:
10/11/07 22:15:40 (6 years ago)
Author:
kentaro
Message:
Files:
1 modified

Legend:

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

    r448 r460  
    3838;;;; * ヴァージョン 
    3939 
    40 (defconst simple-hatena-version "0.04" 
     40(defconst simple-hatena-version "0.05" 
    4141  "simple-hatena-mode.elのヴァージョン。") 
    4242 
     
    6969このidを変更するには、simple-hatena-change-default-idを実行する。") 
    7070 
     71(defcustom simple-hatena-use-timestamp-permalink-flag t 
     72  "はてなダイアリーライターのパーマリンクに、タイムスタンプを使う 
     73かどうかを指定するフラグ。") 
     74 
     75(defcustom simple-hatena-time-offset nil 
     76  "日付を計算する際に用いるオフセット。 
     776 に設定すると午前6時まで前日の日付として扱われる" 
     78  :type 'integer 
     79  :group 'simple-hatena) 
     80 
    7181;; はてダラにわたすオプション 
    7282(defcustom simple-hatena-option-useragent (simple-hatena-version) 
    7383  "はてなダイアリーライターのユーザエージェントオプションを指定す 
    74 る。実行時に、-aオプションとして使われる。") 
     84る。 
     85 
     86実行時に、-aオプションとして使われる。") 
    7587 
    7688(defcustom simple-hatena-option-debug-flag nil 
    77   "はてなダイアリーライターを、デバッグモードで実行するか否かを 
    78 フラグ。 
     89  "はてなダイアリーライターを、デバッグモードで実行するか否かを 
     90定するフラグ。 
    7991 
    8092はてなダイアリーライター実行時に、-dオプションとしてわたされ、また、 
     
    8597 
    8698(defcustom simple-hatena-option-timeout "30" 
    87   "はてなダイアリーライターのタイムアウトを指定する。実行時に、-T 
    88 オプションとして使われる。") 
     99  "はてなダイアリーライターのタイムアウトを指定する。 
     100 
     101実行時に、-Tオプションとして使われる。") 
    89102 
    90103(defcustom simple-hatena-option-cookie-flag t 
    91104  "はてなダイアリーライターのログインに、cookieを利用するかどうか 
    92 を指定するフラグ。実行時に、-cオプションとして使われる。") 
     105を指定するフラグ。 
     106 
     107実行時に、-cオプションとして使われる。") 
    93108 
    94109;; キーバインド 
     
    105120(define-key simple-hatena-mode-map (kbd "C-c C-d") 'simple-hatena-toggle-debug-mode) 
    106121(define-key simple-hatena-mode-map (kbd "C-c C-e") 'simple-hatena-exit) 
     122 
     123;; simple-hatena-use-timestamp-permalink-flagがtなら、*に 
     124;; simple-hatena-electric-asteriskを割り当てる。 
     125(when simple-hatena-use-timestamp-permalink-flag 
     126  (define-key simple-hatena-mode-map "*" 'simple-hatena-electric-asterisk)) 
    107127 
    108128;; フック 
     
    355375  (message "simple-hatena-mode has been exited")) 
    356376 
     377(defun simple-hatena-electric-asterisk (arg) 
     378  "*(アスタリスク)押下により、タイムスタンプ付き小見出しを挿入する。 
     379 
     380ポイントが行頭にある場合のみ、タイムスタンプを挿入し、その他の場合 
     381は、通常通りアスタリスクを挿入する。" 
     382  (interactive "*p") 
     383  (if (zerop (current-column)) 
     384      (simple-hatena-timestamp) 
     385    (self-insert-command arg))) 
     386 
    357387;;;; * 内部関数 
    358388 
     
    376406         (if date 
    377407             (append '(0 0 0) date) 
    378            (decode-time)))) 
     408           (apply (lambda (s min h d mon y &rest rest) 
     409                    (list s min (- h (or simple-hatena-time-offset 0)) d mon y)) 
     410                  (decode-time))))) 
    379411 
    380412(defun simple-hatena-internal-go-for (i)