Skip to content

Commit

Permalink
Fixed fill-paragraph so that it does not break line inside of square …
Browse files Browse the repository at this point in the history
…brackets (maruku does not like it when you do that)
  • Loading branch information
Peter Williams authored and Jason Blevins committed Sep 30, 2009
1 parent faf5fd5 commit 66566a5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,12 @@ This is an exact copy of `line-number-at-pos' for use in emacs21."
(forward-line 0)
(1+ (count-lines start (point))))))

(defun markdown-nobreak-p ()
"Returns nil if it is ok for fill-paragraph to insert a line
break at point"
;; are we inside in square brackets
(looking-back "\\[[^]]*"))



;;; Mode definition ==========================================================
Expand Down Expand Up @@ -1407,6 +1413,14 @@ This is an exact copy of `line-number-at-pos' for use in emacs21."

;(add-to-list 'auto-mode-alist '("\\.text$" . markdown-mode))


(add-hook 'markdown-mode-hook
(lambda ()
(make-local-variable 'fill-nobreak-predicate)
(add-hook 'fill-nobreak-predicate 'markdown-nobreak-p)))



(provide 'markdown-mode)

;;; markdown-mode.el ends here

0 comments on commit 66566a5

Please sign in to comment.