unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: Spencer Boucher <spencer@spencerboucher.com>
Cc: Valentijn <valentijn@linux.com>,
	Emacs developers <emacs-devel@gnu.org>,
	Drew Adams <drew.adams@oracle.com>,
	John Yates <john@yates-sheets.org>
Subject: Re: First draft of the Emacs website
Date: Tue, 08 Dec 2015 17:08:20 +0100	[thread overview]
Message-ID: <87poygrki3.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <m2poyhynjh.fsf@spencerboucher.com> (Spencer Boucher's message of "Tue, 08 Dec 2015 10:21:25 -0500")

Spencer Boucher <spencer@spencerboucher.com> writes:

> <#multipart type=alternative><#part type=text/plain>
>
>
>> At the end of the day, we do need to refer to the language by its
>> name, I think, but we could stress that it is a "Python-like"
>> language, to connect with what people might be more familiar with.
>
>
> Calling elisp "python-like" might be a bit of a stretch :)

adjust-parens is an installed package.

     Status: Installed in ‘adjust-parens-3.0/’ (unsigned). Delete
    Version: 3.0
    Summary: Indent and dedent Lisp code, automatically adjust close parens
   Homepage: http://elpa.gnu.org/packages/adjust-parens.html
Other versions: 3.0 (gnu).

This package provides commands for indenting and dedenting Lisp
code such that close parentheses and brackets are automatically
adjusted to be consistent with the new level of indentation.

When reading Lisp, the programmer pays attention to open parens and
the close parens on the same line. But when a sexp spans more than
one line, she deduces the close paren from indentation alone. Given
that's how we read Lisp, this package aims to enable editing Lisp
similarly: automatically adjust the close parens programmers ignore
when reading. A result of this is an editing experience somewhat
like python-mode, which also offers "indent" and "dedent" commands.
There are differences because lisp-mode knows more due to existing
parens.

To use:
  (require 'adjust-parens)
  (add-hook 'emacs-lisp-mode-hook #'adjust-parens-mode)
  (add-hook 'clojure-mode-hook #'adjust-parens-mode)
  ;; etc

This binds two keys in Lisp Mode:
  (local-set-key (kbd "TAB") 'lisp-indent-adjust-parens)
  (local-set-key (kbd "<backtab>") 'lisp-dedent-adjust-parens)

lisp-indent-adjust-parens potentially calls indent-for-tab-command
(the usual binding for TAB in Lisp Mode). Thus it should not
interfere with other TAB features like completion-at-point.

Some examples follow. | indicates the position of point.

  (let ((x 10) (y (some-func 20))))
  |

After one TAB:

  (let ((x 10) (y (some-func 20)))
    |)

After three more TAB:

  (let ((x 10) (y (some-func 20
                             |))))

After two Shift-TAB to dedent:

  (let ((x 10) (y (some-func 20))
        |))

When dedenting, the sexp may have sibling sexps on lines below. It
makes little sense for those sexps to stay at the same indentation,
because they cannot keep the same parent sexp without being moved
completely. Thus they are dedented too. An example of this:

  (defun func ()
    (save-excursion
      (other-func-1)
      |(other-func-2)
      (other-func-3)))

After Shift-TAB:

  (defun func ()
    (save-excursion
      (other-func-1))
    |(other-func-2)
    (other-func-3))

If you indent again with TAB, the sexps siblings aren't indented:

  (defun func ()
    (save-excursion
      (other-func-1)
      |(other-func-2))
    (other-func-3))

Thus TAB and Shift-TAB are not exact inverse operations of each
other, though they often seem to be.

[back]

-- 
David Kastrup



  reply	other threads:[~2015-12-08 16:08 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-28 23:29 First draft of the Emacs website Nicolas Petton
2015-11-28 23:51 ` Jean-Christophe Helary
2015-11-29  0:03 ` Daniel Pimentel
2015-11-29  1:02 ` Xue Fuqiao
2015-11-29  1:26   ` Nicolas Petton
2015-11-29  2:19     ` Alex Dunn
2015-11-29  3:31       ` Jean-Christophe Helary
2015-11-29  5:42         ` Random832
2015-11-29  8:15           ` David Caldwell
2015-11-29 14:25             ` Dmitry Gutov
2015-11-30 17:49             ` Emacs for Mac OS X bundle (was: First draft of the Emacs website) John Wiegley
2015-11-30 20:02               ` Emacs for Mac OS X bundle David Caldwell
2015-12-01  0:15                 ` Xue Fuqiao
2015-12-01  1:40                   ` David Caldwell
2015-11-30  0:02     ` First draft of the Emacs website Xue Fuqiao
2015-11-29  8:06 ` Przemysław Wojnowski
2015-11-29 10:27   ` Zack Piper
2015-11-29 12:36     ` Rasmus
2015-11-29 12:58       ` Nicolas Petton
2015-11-29 14:00       ` Marcin Borkowski
2015-11-29 10:15 ` David Engster
2015-11-29 12:56   ` Nicolas Petton
2015-11-29 15:17 ` Dmitry Gutov
2015-11-29 19:38   ` Nicolas Petton
2015-11-29 22:01     ` Dmitry Gutov
2015-11-29 22:11       ` Nicolas Petton
2015-11-29 16:21 ` Christopher Allan Webber
2015-11-29 19:39   ` Nicolas Petton
2015-11-29 21:45 ` Artur Malabarba
2015-11-29 22:11   ` Nicolas Petton
2015-11-30  0:04     ` Artur Malabarba
2015-11-30  1:29       ` Alex Dunn
2015-11-30  9:43         ` Artur Malabarba
2015-11-30 10:33           ` Dani Moncayo
2015-11-30 15:22             ` Drew Adams
2015-11-30 16:06   ` Nicolas Petton
2015-11-30 16:16     ` Yuri Khan
2015-11-30 16:23       ` Nicolas Petton
2015-12-01 14:37     ` Richard Stallman
2015-12-01 14:56       ` Nicolas Petton
2015-11-30 19:48 ` Milan Zamazal
2015-12-02 16:45   ` Drew Adams
2015-12-02 17:22     ` Nicolas Petton
2015-12-02 16:36 ` Random832
2015-12-02 17:12   ` Nicolas Petton
2015-12-02 18:07     ` Yuri Khan
2015-12-02 18:26       ` Nicolas Petton
2015-12-02 18:29       ` Nicolas Petton
2015-12-02 18:30         ` Yuri Khan
2015-12-02 23:47   ` Xue Fuqiao
2015-12-04  3:57     ` Random832
2015-12-04  5:17       ` License of the Emacs website (was: Re: First draft of the Emacs website) Chad Brown
2015-12-05  0:19       ` First draft of the Emacs website Richard Stallman
2015-12-03 13:58 ` Clément Pit--Claudel
2015-12-03 22:17   ` John Yates
2015-12-03 22:30     ` Nicolas Petton
2015-12-03 22:57     ` Drew Adams
2015-12-03 23:26       ` John Yates
2015-12-04  0:58         ` Drew Adams
2015-12-08 13:05           ` Valentijn
2015-12-08 15:09             ` Drew Adams
2015-12-08 15:21               ` Spencer Boucher
2015-12-08 16:08                 ` David Kastrup [this message]
2015-12-08 20:52                 ` Marcin Borkowski
2015-12-08 21:51                   ` Drew Adams
2015-12-08 21:58                     ` Drew Adams
2015-12-09 21:00                     ` Marcin Borkowski
2015-12-10  5:28                     ` Richard Stallman
2015-12-10  9:10                       ` David Kastrup
2015-12-10  5:27                   ` Richard Stallman
2015-12-10 16:13                     ` Python vs Lisp (followups to -tangents) Random832
2015-12-10 18:40                       ` Sam Steingold
2015-12-10 22:31                         ` Random832
2015-12-16 15:57                           ` Sam Steingold
2015-12-16 17:56                           ` Christopher Allan Webber
2015-12-09  6:06                 ` First draft of the Emacs website Richard Stallman
2015-12-04  6:06         ` David Kastrup
2015-12-04  9:37           ` Eli Zaretskii
2015-12-04  9:42             ` David Kastrup
2015-12-04 10:11               ` Eli Zaretskii
2015-12-04 10:42                 ` Nicolas Petton
2015-12-04 10:44                 ` David Kastrup
2015-12-04 11:03                   ` Eli Zaretskii
2015-12-04 22:26                   ` Paul Eggert
2015-12-04 22:30                     ` David Kastrup
2015-12-04  8:42         ` Eli Zaretskii
2015-12-03 23:59     ` Clément Pit--Claudel
  -- strict thread matches above, loose matches on Subject: below --
2015-12-02 12:47 H.Tsurumoto
2015-12-02 13:07 ` David Kastrup
2015-12-02 14:55   ` Random832
2015-12-02 15:16     ` David Kastrup
2015-12-02 15:39       ` Drew Adams
2015-12-02 15:42       ` Nicolas Petton
2015-12-02 15:53         ` David Kastrup
2015-12-02 16:07           ` Nicolas Petton
2015-12-02 15:55         ` Yuri Khan
2015-12-02 15:57           ` Nicolas Petton
2015-12-02 16:05             ` David Kastrup
2015-12-02 16:07             ` Yuri Khan
2015-12-02 16:08           ` Random832
2015-12-03  6:22         ` Richard Stallman
2015-12-03  9:29           ` Nicolas Petton
2015-12-03  9:59             ` Alexis
2015-12-03 10:51               ` Nicolas Petton
2015-12-04  5:22                 ` Richard Stallman
2015-12-04  9:07                   ` Nicolas Petton
2015-12-04  5:22             ` Richard Stallman
2015-12-04  9:36               ` Nicolas Petton
2015-12-03  6:21   ` Richard Stallman
2015-12-02 14:14 ` Nicolas Petton
2015-12-02 16:39   ` David Engster

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87poygrki3.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=john@yates-sheets.org \
    --cc=spencer@spencerboucher.com \
    --cc=valentijn@linux.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.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).