`(blog ,garaemon)

ポップカルチャーを摂取して、コードを吐き出す機械

emacsで毎日のメモのためのmarkdownを自動的に作成する

メモをとるのにmarkdownはとても便利.

emacsで作業中のメモをとるためのmarkdownを日別に自動的に作成するemacs lispのコード.

~/daily-notes/の下に日付の入ったファイル名を自動生成する. また、先頭に日付も自動的に挿入するようにしている.

(defvar daily-markdown-memo-directory "~/daily-notes"
  "Directory to save daily markdown memos.")
(defun daily-markdown-memo-create-today-markdown ()
  "Create markdown file for today under DAILY-MARKDOWN-MEMO-DIRECTORY."
  (interactive)
  ;; If there is no memo directory, create it.
  (if (not (file-directory-p daily-markdown-memo-directory))
      (progn
        (message "Creating directory: %s" daily-markdown-memo-directory)
        (make-directory daily-markdown-memo-directory)))
  (let ((today-file-full-path
         (let ((today-file (format-time-string "%Y-%m-%d.md" (current-time))))
           (concat daily-markdown-memo-directory "/" today-file))))
    ;; Verify if the buffer is already opened for today-file-full-path.
    ;; If not,
    (let ((file-buffer (find-file-noselect today-file-full-path)))
      (with-current-buffer file-buffer
        (if (not (file-exists-p today-file-full-path))
            ;; If it is the first time to open the file, insert date and save it automatically.
            (progn
              (insert (format-time-string "# %Y-%m-%d" (current-time)))
              (save-buffer))))))
  )
;; Run daily-markdown-memo-create-today-markdown when emacs is opened.
(add-hook 'after-init-hook '(daily-markdown-memo-create-today-markdown))
;; Run daily-markdown-memo-create-today-markdown every 30 minutes
(run-with-timer 0 (* 30 60) 'daily-markdown-memo-create-today-markdown)

emacsのC-sをhelm-swoopで置き換える

最近emacsの検索のキーバインドであるC-shelm-swoopに置き換えてみている.

helm-swoopに関する説明はこちらが詳しい

emacs.rubikitch.com

C-sのたびにバッファがかちゃかちゃしてうるさい気もするけど、使いこなせれば作業効率が上がりそうな気がする.

僕が使っている設定は以下のような感じ.

(global-set-key (kbd "C-s") 'helm-swoop)
(define-key helm-swoop-map (kbd "C-r") 'helm-previous-line)
(define-key helm-swoop-map (kbd "C-s") 'helm-next-line)
(define-key helm-multi-swoop-map (kbd "C-r") 'helm-previous-line)
(define-key helm-multi-swoop-map (kbd "C-s") 'helm-next-line)
;; Disable pre-input for helm-swoop
(setq helm-swoop-pre-input-function (lambda () nil))

Coachellaのyoutube配信

“When you said you would take me to California for the first time, I thought you meant Coachella or Disneyland."

Black Pantherでシュリが「カリフォルニアに連れて行ってくれるって言うから、コーチェラかディズニーランドかと思ったのに」というセリフでもおなじみのコーチェラが去年に引き続きyoutubeで生配信されるらしい.

www.coachella.com

コーチェラはカリフォルニアで開催される音楽フェス. 開催期間は4月13日から15日の三日間. ラインナップを見るとヘッドライナーはThe Weeknd, Beyonce, Eminemということでヒップホップ色がかなり強い。 日本からはX Japanが参加することでも話題になってる.

www.coachella.com

日本から見ると夜中から朝方にかけての配信がメインになるのかな? なかなか起きているのが大変そうだ.

Cam O'bi "TenderHeaded ft. Smino"

Cam O'biというアーティストの"TenderHeaded ft. Smino"という曲がメロウで大変素晴らしい

www.youtube.com

Cam O'biというアーティストの名前は聞いたことがなかったが、どうやらChance the Rapperの曲にプロデューサとして参加しているようだ.

soundcloud.com

本作でフィーチャリングされているSminoもChanceと親しくしているらしい.

www.youtube.com

Sminoは4月に来日したことも記憶に新しい.

Cam O'biのディスコグラフィとしては, SZAのCtrlでKendricとも仕事をしている.

www.youtube.com

タイトルのTenderHeadedとはあれやすい頭皮という意味なのかな (Urban Dictionary). 黒人の人達に多い癖っ毛が櫛に絡んで頭皮が痛みやすい、というニュアンスなのだろうか。実際Cam O'biの写真をみていると, 彼自身がTenderHeadedなのだろう(というか, 曲中でもそういってる)

www.instagram.com

Cam O'biのinstagramはナイーブな青年っぽさが現れていて、彼を身近に感じられて素晴らしい.

Cam O'biは今後はプロデューサだけではなく、ソロアーティストとして活動していくのだろうか? はやく新譜が聞きたい

Cardi Bの新譜がすごい

Cardi Bの新譜, というかデビューアルバム Invasion of Privacy が4月6日にリリースされた.

open.spotify.com

参加アーティストも豪華だし、とにかくアルバムとしてのクオリティが高い. 個人的にはやはりChance the RapperとのBest Lifeがお気に入り.

open.spotify.com

GeniusでもCardi Bの新譜の曲が上位にたくさん来ている f:id:garaemon1:20180411012106p:plain

先週はDrakeの新曲 Nice for What もリリースされている、忙しいことこの上ない.

open.spotify.com

emacsの文字サイズの変更をよくあるキーバインドにする

emacsで文字サイズを大きくおよび小さくするキーバインドC-x C-+, C-x C--に割り振ってあるが、最近は(macだと) ⌘-+/-に割り振ってあるものが多い.

以下のように.emacsに書いておくと, macならそのようなキーバインドになる. Linuxだと\Mのかわりに\Cにしたほうが良いかも.

(defun text-scale-increase ()
  "Increase the size of text of CURRENT-BUFFER."
  (interactive)
  (text-scale-adjust +1))

(defun text-scale-decrease ()
  "Decrease the size of text of CURRENT-BUFFER."
  (interactive)
  (text-scale-adjust -1))

(defun text-scale-reset ()
  "Reset the size of text of CURRENT-BUFFER."
  (interactive)
  (text-scale-adjust 0))

(global-set-key "\M-+" 'text-scale-increase)
(global-set-key "\M--" 'text-scale-decrease)
(global-set-key "\M-0" 'text-scale-reset)