summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2023-11-08 16:23:48 -0500
committerSacha Chua <sacha@sachachua.com>2023-11-08 16:23:48 -0500
commitbbe661d70c8bd949ebe27422bca776cbd298a615 (patch)
tree6a5eb5512fb995168ee289f972c8c81f3b5cef47
parente8080e1b27388dc11cef9b72bd741d41ec58545e (diff)
downloademacsconf-el-bbe661d70c8bd949ebe27422bca776cbd298a615.tar.xz
emacsconf-el-bbe661d70c8bd949ebe27422bca776cbd298a615.zip
merge and unfill
-rw-r--r--emacsconf-subed.el40
1 files changed, 24 insertions, 16 deletions
diff --git a/emacsconf-subed.el b/emacsconf-subed.el
index f49b2f2..95480cd 100644
--- a/emacsconf-subed.el
+++ b/emacsconf-subed.el
@@ -302,27 +302,35 @@ Create it if necessary."
(subed-split-subtitle)
(recenter))
-(defun emacsconf-subed-merge-and-fill ()
+(defun emacsconf-subed-merge-and-unfill ()
"Merge this subtitle with the next one."
(interactive)
(subed-merge-with-next)
- (fill-paragraph))
+ (emacsconf-subed-unfill-paragraph))
+
+(defun emacsconf-subed-unfill-paragraph ()
+ "Sometimes the regular fill doesn't work."
+ (interactive)
+ (subed-set-subtitle-text
+ (replace-regexp-in-string
+ "\n+" " "
+ (subed-subtitle-text))))
(defvar emacsconf-subed-split-map
- (let ((map (make-sparse-keymap)))
- (define-key map [down-mouse-1] #'emacsconf-subed-split-at-mouse)
- (define-key map [mouse-1] #'ignore)
- (define-key map [up-1] #'ignore)
- (define-key map [drag-mouse-1] #'ignore)
- (define-key map [mouse-movement] #'ignore)
- (define-key map (kbd "<down>") #'scroll-up)
- (define-key map (kbd "M-q") #'fill-paragraph)
- (define-key map (kbd "M-.") #'emacsconf-subed-merge-and-fill)
- (define-key map "q" #'fill-paragraph)
- (define-key map "." #'emacsconf-subed-merge-and-fill)
- (define-key map "u" #'undo)
- (define-key map (kbd "SPC") #'scroll-up)
- map)
+ (let ((map (make-sparse-keymap)))
+ (define-key map [down-mouse-1] #'emacsconf-subed-split-at-mouse)
+ (define-key map [mouse-1] #'ignore)
+ (define-key map [up-1] #'ignore)
+ (define-key map [drag-mouse-1] #'ignore)
+ (define-key map [mouse-movement] #'ignore)
+ (define-key map (kbd "<down>") #'scroll-up)
+ (define-key map (kbd "M-q") #'emacsconf-subed-unfill-paragraph)
+ (define-key map (kbd "M-.") #'emacsconf-subed-merge-and-unfill)
+ (define-key map "q" #'emacsconf-subed-unfill-paragraph)
+ (define-key map "." #'emacsconf-subed-merge-and-unfill)
+ (define-key map "u" #'undo)
+ (define-key map (kbd "SPC") #'scroll-up)
+ map)
"Map for splitting.")
(defun emacsconf-subed-split ()