(defun english-reading () (interactive) (let ((bname (format "*ER:%s*" (buffer-name))) (pt (point)) (ws (window-start)) (mode major-mode) (cb (current-buffer))) (switch-to-buffer (generate-new-buffer bname)) (funcall mode) (setq-local inhibit-read-only t) (insert-buffer-substring-no-properties cb) (goto-char pt) (set-window-start (selected-window) ws) ;; uncomment-region-function in org-mode is org-comment-or-uncomment-region ;; so, uncomment-region COMMENTS whole buffer. (when (and comment-start (not (memq major-mode '(org-mode)))) (uncomment-region (point-min) (point-max))) (english-reading-mode))) (defun english-reading-mouse-open-line (event) (interactive "e") (posn-set-point (event-end event)) (unless (eq ?\ (char-syntax (char-after))) (forward-word 1)) (open-line 1)) (defun english-reading-mouse-highlight-current-word (e) (interactive "e") (mouse-set-point e) (let ((bow (bounds-of-thing-at-point 'word))) (overlay-put (make-overlay (car bow) (cdr bow)) 'face 'highlight))) (defun english-reading-mouse-delete-indentation (event) (interactive "e") (posn-set-point (event-end event)) (delete-indentation) (when (and (not (< 0 (char-before) 127 )) (eq (char-after) ?\s)) (delete-char 1))) (define-derived-mode english-reading-mode text-mode "ER" (when (bound-and-true-p mouse-click-scroll-mode) (setq-local mouse-click-scroll-mode nil)) (setq-local mouse-wheel-scroll-amount '(3)) ; HERE! (face-remap-add-relative 'default :height 300) ; HERE! (define-key english-reading-mode-map (kbd "") 'ignore) (define-key english-reading-mode-map (kbd "") 'ignore) (define-key english-reading-mode-map (kbd "") 'ignore) (define-key english-reading-mode-map (kbd "") 'english-reading-mouse-open-line) (define-key english-reading-mode-map (kbd "") 'english-reading-mouse-highlight-current-word) (define-key english-reading-mode-map (kbd "") 'english-reading-mouse-delete-indentation)) (provide 'mylisp-english-reading)