Skip to content

Instantly share code, notes, and snippets.

@jewel12
Created June 5, 2012 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jewel12/2873112 to your computer and use it in GitHub Desktop.
Save jewel12/2873112 to your computer and use it in GitHub Desktop.
move-to-next-blank-line
(defun blank-line? ()
(string-match "^\n$" (substring-no-properties (thing-at-point 'line))))
(defun move-to-next-blank-line ()
(interactive)
(progn (forward-line 1)
(if (blank-line?) () (move-to-next-blank-line))))
(defun move-to-previous-blank-line ()
(interactive)
(progn (forward-line -1)
(if (blank-line?) () (move-to-previous-blank-line))))
(global-set-key "\M-n" 'move-to-next-blank-line)
(global-set-key "\M-p" 'move-to-previous-blank-line)
@jidaikobo-shibata
Copy link

forward/backward-paragraphでも、似た動きなんですが、こっちだとパラグラフ判定がたぶんシンタックステーブルに依存しているっぽくて、単純に空行に行って欲しいのに! に応えてくれなかったのが、助かりました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment