3

I've known there's similar question How to strike-through or un-strike-through a region or line in org-mode?

but no proper answer they've got yet.

I just wonder how to make wrapped word or sentence with strike-through easily in my org-mode

'*' '=' '_' symbols are working correctly with wrapped word or sentence but '+' not working which I want to use.

is there anyone who knows how to solve this problem?

Thank you!

5
  • Please specify your org-version. Word or line works OK for me in version 9.1.3, but not for a sentence longer than a line. Commented Nov 8, 2018 at 13:55
  • @Ian org-mode version which I'm using is 9.1.11 :-) Commented Nov 8, 2018 at 14:09
  • Please check the variable org-emphasis-alist. This controls what is to be bold, italic, etc. Mine has also this: (:strike-through t) . Commented Nov 8, 2018 at 14:53
  • @Ian That's right I checked org-emphasis-alist before but everything is working except for + keyword ;-/ and I just wrote 2 functions that can do strike-through automatically. Thank you for kind help anyway! :-) Commented Nov 8, 2018 at 14:56
  • Does your functions works for a sentence on more lines or region? If yes, then you can write an answer for the link provided inside question. Commented Nov 8, 2018 at 14:58

2 Answers 2

2

Use wrap-region to add automatic wrapping to org-mode text characters, including the "+".

 (use-package wrap-region :ensure t :config (wrap-region-global-mode t) (wrap-region-add-wrapper "~" "~" nil 'org-mode) ; code (wrap-region-add-wrapper "*" "*" nil 'org-mode) ; bold (wrap-region-add-wrapper "/" "/" nil 'org-mode) ; italic (wrap-region-add-wrapper "+" "+" nil 'org-mode) ; strikethrough (wrap-region-add-wrapper "=" "=" nil 'org-mode)) ; verbatim 
1
  • Oh! That seems like pretty useful package :-) Thank you @Heikki Commented Nov 9, 2018 at 11:20
1

You can use this function on a single line. put your cursor on a line, then use this function. (for only org-mode)

 (defun strike-through-for-org-mode () (interactive) (beginning-of-line) (save-excursion (if (string-prefix-p "*" (thing-at-point 'line t)) (progn (setq go_char (string-match "[ ]" (thing-at-point 'line t))) (forward-char (+ go_char 1)) (insert "+") (end-of-line) (insert "+") ) (if (string-match "[^ ]" (thing-at-point 'line t)) (progn (setq go_char (string-match "[^ ]" (thing-at-point 'line t))) (forward-char (+ go_char 2)) (insert "+") (end-of-line) (insert "+") ) (message "[-] Not Proper Position!") ) ) ) ) 

(defun strike-through-for-org-mode-undo () (interactive) (beginning-of-line) (save-excursion (if (string-match "[+]" (thing-at-point 'line t)) (progn (setq go_char (string-match "[+]" (thing-at-point 'line t))) (forward-char go_char) (delete-char 1) (end-of-line) (delete-char -1) ) (message "[-] Not Proper Position!") ) ) ) 
1
  • I've just written some simple functions which can do strike-through automatically in cursor line. hope it helps some people who need this feature Commented Nov 8, 2018 at 14:53

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.