LoginSignup
2

More than 5 years have passed since last update.

qiita.elで専用バッファを作ってそこから投稿するようにしてみた

Last updated at Posted at 2013-10-19

Qiita.el

投稿するときにファイルを作成したり、新規にバッファを作ったりするのが
面倒だったので、qiita:newを実行すると自動的にバッファが作成されるように
してみた。

;;;###autoload
(defun qiita:new (&optional entry)
  "Open a buffer for a Qiita entry."
  (interactive)
  (switch-to-buffer (qiita:new-noselect entry)))

;;;###autoload
(defun qiita:new-noselect (&optional entry buf)
  "Open a buffer for a Qiita entry without selecting the buffer."
  (interactive)
  (let* ((title " Title")
         (content "")
         (buf (get-buffer-create qiita->new-post-buffer)))
    (with-current-buffer buf
      ;; initialize
      (erase-buffer)
      (insert (format "# %s\n\n" title))
      (insert content)
      (unless (= (char-before (point)) ?\n) (insert "\n"))
      (markdown-mode)
      (goto-char (point-min))
      (setq buffer-undo-list nil)
      (set-buffer-modified-p nil))
    buf))

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2