From 2fecc133700f277dd78f7a9200e388dc614acd28 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 24 Nov 2022 23:15:12 +0000 Subject: renamed mrl-functions --- init.el | 4 +--- lisp/mrl-functions.el | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ lisp/mrl_functions.el | 49 ------------------------------------------------- 3 files changed, 50 insertions(+), 52 deletions(-) create mode 100644 lisp/mrl-functions.el delete mode 100644 lisp/mrl_functions.el diff --git a/init.el b/init.el index 3c3352e..4f06ec6 100644 --- a/init.el +++ b/init.el @@ -4,8 +4,6 @@ ;;; basic config ;;; Code: - - (defvar mrl/startup-time (current-time)) (defun mrl/emacs-load-time () (let ((time (float-time (time-subtract (current-time) mrl/startup-time)))) @@ -71,7 +69,7 @@ Restart works only on graphic display." ;; load my crap (add-to-list 'load-path "~/.emacs.d/lisp") -(require 'mrl_functions) +(require 'mrl-functions) (require 'org-notmuch) (org-link-set-parameters "notmuch" diff --git a/lisp/mrl-functions.el b/lisp/mrl-functions.el new file mode 100644 index 0000000..3ba9eff --- /dev/null +++ b/lisp/mrl-functions.el @@ -0,0 +1,49 @@ +;; for markdown mode +(defun mrl/get-start-and-lines-in-region () + "Cumbersome newbie way to get start line and number +of lines in region." + (let (pos1 pos2) + (setq pos1 (region-beginning) + pos2 (region-end)) + (let ((line1 (line-number-at-pos pos1)) + (line2 (line-number-at-pos pos2))) + (list line1 (- line2 line1))))) + +(defun mrl/clear-check-region (start lines) + "Clears check marks given a start line and number +of lines to run through." + (setq count 0) + (while (> lines 0) + (save-excursion + (goto-line (+ start count)) + (beginning-of-line) + (forward-char 3) + (delete-char 1) + (insert-char ?\s)) + (next-line) + (setq count (+ count 1)) + (setq lines (- lines 1)))) + + +(defun mrl/clear-check-from-region () + "Interactive func to clear markdown checks from a region." + (interactive) + (save-excursion + (mrl/clear-check-region + (car (mrl/get-start-and-lines-in-region)) + (car (last (mrl/get-start-and-lines-in-region)))))) + +;; do this for a region next +(defun mrl/clear-check-single-line (&optional lines) + "Remove the check from LINES number of markdown checkbox lines." + (interactive "p") + (while (> lines 0) + (save-excursion + (beginning-of-line) + (forward-char 3) + (delete-char 1) + (insert-char ?\s)) + (next-line) + (setq lines (- lines 1)))) +(provide 'mrl-functions) +;;; mrl_functions ends here diff --git a/lisp/mrl_functions.el b/lisp/mrl_functions.el deleted file mode 100644 index 75f0eaa..0000000 --- a/lisp/mrl_functions.el +++ /dev/null @@ -1,49 +0,0 @@ -;; for markdown mode -(defun mrl/get-start-and-lines-in-region () - "Cumbersome newbie way to get start line and number -of lines in region." - (let (pos1 pos2) - (setq pos1 (region-beginning) - pos2 (region-end)) - (let ((line1 (line-number-at-pos pos1)) - (line2 (line-number-at-pos pos2))) - (list line1 (- line2 line1))))) - -(defun mrl/clear-check-region (start lines) - "Clears check marks given a start line and number -of lines to run through." - (setq count 0) - (while (> lines 0) - (save-excursion - (goto-line (+ start count)) - (beginning-of-line) - (forward-char 3) - (delete-char 1) - (insert-char ?\s)) - (next-line) - (setq count (+ count 1)) - (setq lines (- lines 1)))) - - -(defun mrl/clear-check-from-region () - "Interactive func to clear markdown checks from a region." - (interactive) - (save-excursion - (mrl/clear-check-region - (car (mrl/get-start-and-lines-in-region)) - (car (last (mrl/get-start-and-lines-in-region)))))) - -;; do this for a region next -(defun mrl/clear-check-single-line (&optional lines) - "Remove the check from LINES number of markdown checkbox lines." - (interactive "p") - (while (> lines 0) - (save-excursion - (beginning-of-line) - (forward-char 3) - (delete-char 1) - (insert-char ?\s)) - (next-line) - (setq lines (- lines 1)))) -(provide 'mrl_functions) -;;; mrl_functions ends here -- cgit v1.2.3