From: Bastien <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: Changing font
Date: Fri, 18 May 2007 21:21:35 +0200 [thread overview]
Message-ID: <87wsz6x7i8.fsf@bzg.ath.cx> (raw)
Hi,
i'm using this bunch of defuns for a long time now and i think it might
comes in handy for others. It allows you to quickly change the font
markers around the selected text.
I'm using "C-c f [key]" rather than the more expected "C-c C-f [key]"
(see latex-mode) because "C-c C-f" is already taken by outline-mode.
========================================================================
(org-defkey org-mode-map "\C-cfb" 'my-org-change-font-bold)
(org-defkey org-mode-map "\C-cfe" 'my-org-change-font-emphasis)
(org-defkey org-mode-map "\C-cfu" 'my-org-change-font-underline)
(org-defkey org-mode-map "\C-cft" 'my-org-change-font-truetype)
(org-defkey org-mode-map "\C-cfn" 'my-org-change-font-normal)
(defun my-org-change-font (tagbeg tagend)
"Insert TAGBEG and TAGEND at the beginning/end of a region."
(let* ((beg (if (org-region-active-p) (mark) (point)))
(end (point)) (temp beg) (spcs '(?* ?= ?_ ?/)))
(when (< end beg) (setq beg end end temp))
(goto-char beg)
(while (memq (char-before (point)) spcs)
(delete-char -1)
(setq end (1- end)))
(insert tagbeg)
(goto-char (+ (length tagbeg) end))
(while (memq (char-after (point)) spcs)
(delete-char 1))
(save-excursion (insert tagend))))
(defun my-org-change-font-bold ()
"Change font to bold."
(interactive)
(my-org-change-font "*" "*"))
(defun my-org-change-font-emphasis ()
"Change font to emphasis."
(interactive)
(my-org-change-font "/" "/"))
(defun my-org-change-font-truetype ()
"Change font to truetype."
(interactive)
(my-org-change-font "=" "="))
(defun my-org-change-font-underline ()
"Change font to underline."
(interactive)
(my-org-change-font "_" "_"))
(defun my-org-change-font-normal ()
"Strip any font beautifier."
(interactive)
(my-org-change-font "" ""))
========================================================================
--
Bastien
next reply other threads:[~2007-05-18 19:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-18 19:21 Bastien [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-08-21 21:06 changing font Masrur Hossain
2005-08-21 21:15 ` Matthieu Moy
2005-08-21 21:22 ` Masrur Hossain
2005-08-21 21:34 ` Michael Cadilhac
2005-08-21 21:43 ` Matthieu Moy
2005-08-21 21:54 ` Jochen Küpper
2005-08-21 21:28 ` Eli Zaretskii
[not found] ` <mailman.4525.1124660399.20277.help-gnu-emacs@gnu.org>
2005-08-21 21:47 ` Masrur Hossain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wsz6x7i8.fsf@bzg.ath.cx \
--to=bzg@altern.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.