emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Roland Everaert <reveatwork@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: electric-pair, autopair, smartparens, etc in org-mode
Date: Tue, 23 Oct 2018 19:48:33 +0800	[thread overview]
Message-ID: <878t2oubn2.fsf@gmail.com> (raw)
In-Reply-To: <87zhv5nlgv.fsf@gmail.com>


Roland Everaert <reveatwork@gmail.com> writes:

> Hi,
>
> I use the following configuration:
>
>     ;;;;;;;;;;;;;;;; parenthèses, accolades et brackets ;;;;;;
>     (setq skeleton-pair t)
>     (global-set-key "[" 'skeleton-pair-insert-maybe)
>     (global-set-key "{" 'skeleton-pair-insert-maybe)
>     (global-set-key "(" 'skeleton-pair-insert-maybe)
>     (global-set-key "\"" 'skeleton-pair-insert-maybe)
>     (global-set-key "'" 'skeleton-pair-insert-maybe)
>
> This will only close the defined characters.
>
>
> Hope this will help.
>
> Roland.
>

This is really helpful for me, I use smartparens before, but it is a little heavy. So I disabled it. I found your solution is simple and fast. I modified a little:

#+begin_src emacs-lisp
(require 'skeleton)
(setq skeleton-pair t)

(define-key org-mode-map (kbd "~") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "=") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "*") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "+") 'skeleton-pair-insert-maybe)

(define-key org-mode-map (kbd "[") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "{") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "(") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "\"") 'skeleton-pair-insert-maybe)
(define-key org-mode-map (kbd "'") 'skeleton-pair-insert-maybe)
#+end_src

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

  reply	other threads:[~2018-10-23 11:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21  0:36 electric-pair, autopair, smartparens, etc in org-mode Matt Price
2018-10-21  7:28 ` Nicolas Goaziou
2018-10-21 16:43   ` Matt Price
2018-10-23  7:58     ` Roland Everaert
2018-10-23 11:48       ` stardiviner [this message]
2018-10-23 13:07         ` Eric S Fraga
2018-10-24 13:12           ` Matt Price
2018-10-24 14:15             ` Eric S Fraga
2018-10-24 10:38         ` Roland Everaert
2018-10-24 10:45           ` Eric S Fraga
2018-10-24 21:24             ` Tim Cross
2018-10-25 15:07               ` Eric S Fraga
2018-10-25 22:57                 ` Samuel Wales
2018-10-25 22:59                   ` Samuel Wales
2018-10-26  9:23                   ` Eric S Fraga
2018-10-26 21:45                   ` Tim Cross

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878t2oubn2.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=reveatwork@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).