rust-lang / rust-lang/rust-mode

[PR] Add `single quotes` into electric-pair-pairs for emacs version>24.1 to make it can be autopaired

Open
#402 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Emacs Lisp
Stars
1.3k
Forks
198
PR merge metrics
No merged PRs in 30d

Description

This variable it original value is:

((?\" . ?\")
    (,(nth 0 electric-quote-chars) . ,(nth 1 electric-quote-chars))
    (,(nth 2 electric-quote-chars) . ,(nth 3 electric-quote-chars)))

So, when we do coding on rust-mode, when we typing double quotes ", it can be autopaired into "|" (| is cursor)
But, single quote can't.

After add following code into rust-mode-hook

(add-to-list (make-local-variable 'electric-pair-pairs) '(?' . ?'))

Now, when we typing '|, it can be autopaired into '|' now, and not take effect others mode. e.g. emacs-lisp-mode

Thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the rust-mode-hook setup and the electric-pair-pairs variable described in the issue. Verify the behavior in rust-mode and a different mode such as emacs-lisp-mode; done means single quotes pair in rust-mode for Emacs versions above 24.1 without changing other modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp, rust
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.