all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, John Yates <john@yates-sheets.org>
Cc: daniele@grinta.net, emacs-devel@gnu.org
Subject: Re: Major mode and implementation of expected editing facilities
Date: Wed, 29 May 2019 00:11:38 -0400	[thread overview]
Message-ID: <40f1648f-2552-dbcd-cae9-d7d7424f657c@gmail.com> (raw)
In-Reply-To: <83h89eyopq.fsf@gnu.org>

On 2019-05-28 22:33, Eli Zaretskii wrote:
> If you or someone else want to suggest improvements for that chapter
> of the manual, please do, and thanks in advance.

To get the ball rolling, I'll mention a few facilities that I like major modes to hook into.  Others can likely point out many omissions:

* Syntax tables: see Syntax Tables in the ELisp manual (this helps with font-locking and motion) and syntax-propertize-function

* Font-locking: see font-lock-defaults and font-lock-keywords, and often font-lock-extra-managed-props and font-lock-syntactic-face-function

* Completion: see completion-at-point-functions, or (in ELPA) company-mode

* Outline: See outline-level, outline-regexp, and outline-heading-end-regexp; or hs-special-modes-alist; or both; or (in ELPA) many other packages

* Jump to definition: See xref-backend-functions

* Project: See project-find-functions

* On-the-fly errors: See flymake-mode, or (in ELPA) flycheck-mode

* Filling: See fill-paragraph-function, adaptive-fill-regexp, adaptive-fill-first-line-regexp, and fill-paragraph-handle-comment

* Comments: See comment-start-skip, comment-use-syntax, and comment-multi-line

* Indentation: See indent-line-function, indent-tabs-mode, indent-region-function, and possibly electric-indent-inhibit and electric-indent-chars

* Prettification: See prettify-symbols-alist.

* Auto-insert: See auto-insert-alist

* Eldoc: See eldoc-documentation-function

* Current function: See which-func-functions and add-log-current-defun-function

* Toolbars and menus: See tool-bar-map, easy-menu-define, and imenu-create-index-function

* Compilation: compilation-error-regexp-alist

* Navigation: See forward-sexp-function, parse-sexp-lookup-properties, parse-sexp-ignore-comments, paragraph-start, beginning-of-defun-function, and end-of-defun-function

* Snippets: See skeleton.el, or (in ELPA) yasnippet.

* Key bindings: You don't usually need to define or override many of these, because most keys that are supposed to operate consistently across modes call standardized functions or hooks that your major mode can configure (instead of redefining the corresponding key).  This is the case for M-q or TAB, for example (and even, despite what the manual say, for C-M-a as well).  If you override or create keybindings, please please don't forget the 'delete-selection property, to ensure that the overridden key works well with delete-selection-mode.

Btw, a good place to find these things is existing mode functions; look for setq-local or (set (make-local-variable …) …) in define-derived-mode blocks.

Clément.




  reply	other threads:[~2019-05-29  4:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 22:14 Major mode and implementation of expected editing facilities Daniele Nicolodi
2019-05-28  2:43 ` Eli Zaretskii
2019-05-28  2:47   ` Daniele Nicolodi
2019-05-28  4:20     ` Eli Zaretskii
2019-05-28  4:40       ` Daniele Nicolodi
2019-05-28 14:55         ` Eli Zaretskii
2019-05-28 19:37           ` John Yates
2019-05-28 19:54             ` Daniele Nicolodi
2019-05-29  2:33             ` Eli Zaretskii
2019-05-29  4:11               ` Clément Pit-Claudel [this message]
2019-05-29  4:21                 ` Daniele Nicolodi
2019-05-29 14:34                 ` Eli Zaretskii
2019-05-29 15:35                   ` Clément Pit-Claudel
2019-05-29 15:08                 ` Dmitry Gutov
2019-05-29 15:35                   ` Clément Pit-Claudel
2019-05-29 19:54             ` Richard Stallman
2019-05-28 19:52           ` Daniele Nicolodi
2019-05-28 20:20             ` Noam Postavsky
2019-05-29  2:37               ` Eli Zaretskii
2019-05-29  2:36             ` Eli Zaretskii
2019-05-29  4:14         ` Clément Pit-Claudel
2019-05-29  4:17           ` Daniele Nicolodi

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=40f1648f-2552-dbcd-cae9-d7d7424f657c@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=daniele@grinta.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=john@yates-sheets.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.