1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00
Commit Graph

89 Commits

Author SHA1 Message Date
Philipp Rumpf
3ebdceafc1 * lisp/electric.el (electric-indent-post-self-insert-function): Don't use
`pos' after modifying the buffer.

Fixes: debbugs:17449
2014-05-09 14:03:21 -04:00
Stefan Monnier
e6025d7240 * lisp/electric.el (electric-indent-functions-without-reindent): Add yaml. 2014-05-05 15:04:40 -04:00
Glenn Morris
78540c42f1 * lisp/electric.el (electric-indent-post-self-insert-function): Add doc. 2014-03-21 00:19:21 -07:00
Stefan Monnier
b88eed604a * electric.el (global-map): Really bind C-j.
Fixes: debbugs:16770
2014-03-20 18:00:20 -04:00
Stefan Monnier
494ec1e71d * lisp/electric.el (electric-newline-and-maybe-indent): New command.
Bind it globally to C-j.
(electric-indent-mode): Don't mess with the global map any more.
Don't drop the post-self-insert-hook is some buffer is still using it.
* lisp/bindings.el (global-map): Remove C-j binding.

Fixes: debbugs:16770
2014-03-20 13:14:45 -04:00
Glenn Morris
8a51e8e417 * emacs/indent.texi (Indent Convenience): Mention electric-indent-local-mode.
* lisp/electric.el (electric-indent-mode): Doc fix.

* etc/NEWS: Related markup.
2014-03-11 23:48:20 -07:00
Stefan Monnier
8d4901dc71 * lisp/electric.el (electric-indent-mode-has-been-called): Remove.
(electric-indent-mode): Fix accordingly.
* lisp/progmodes/cc-mode.el (c-initialize-cc-mode): Only hook into
electric-indent-mode-hook if we obey electric-indent-mode.
(c-basic-common-init): Use (fboundp 'electric-indent-local-mode) to
decide whether we obey electric-indent-mode.
(c-change-set-fl-decl-start, c-extend-after-change-region):
Silence warnings.
(c-electric-indent-mode-hook): Assume we do want to obey
electric-indent-mode.
2014-03-03 23:03:34 -05:00
Dmitry Gutov
c8481b1b2c * lisp/electric.el (electric-indent-functions-without-reindent):
Add `yaml-indent-line'.
2014-02-21 16:29:28 +02:00
Alan Mackenzie
29238d289d Connect electric-indent-mode up with CC Mode. Bug #15478.
* progmodes/cc-mode.el (c-initialize-cc-mode): add CC Mode hooks
to electric-indent-{,local-}-mode.
(c-basic-common-init): Set electric-indent-inhibit.  Initialise
c-electric-flag from electric-indent-mode.
(c-electric-indent-mode-hook, c-electric-indent-local-mode-hook):
New hook functions which propagate electric-indent-mode to CC Mode.

* progmodes/cc-cmds.el (c-toggle-electric-state): When C-c C-l is
hit, toggle electric-indent-local-moode.

* electric.el (electric-indent-mode-has-been-called): New variable.
2014-02-17 18:16:32 +00:00
Glenn Morris
34dc21db6e Replace "Maintainer: FSF" with the emacs-devel mailing address 2014-02-09 17:34:22 -08:00
Paul Eggert
ba3189039a Update copyright year to 2014 by running admin/update-copyright. 2014-01-01 07:43:34 +00:00
Stefan Monnier
7514d3f806 * lisp/electric.el: Move all electric-pair-* to elec-pair.el.
* lisp/elec-pair.el: New file, split from electric.el.
2013-12-27 07:53:57 -05:00
João Távora
3b8d5131a3 Make Electric Pair mode smarter/more useful:
* lisp/electric.el: Pairing/skipping helps preserve
  balance. Autobackspacing behaviour. Opens extra newlines between
  pairs. Skip whitespace before closing delimiters.

* lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables): Use new
  features.

* test/automated/electric-tests.lisp: New file.

* doc/emacs/programs.texi: Describe new features.

* lisp/simple.el: Pass non-nil interactive arg to newline call inside
  newline-and-indent.
2013-12-26 22:02:49 +00:00
Stefan Monnier
da04812763 * lisp/electric.el (electric-indent-mode): Enable by default.
* lisp/loadup.el: Preload "electric".
* src/lisp.mk (lisp): Add electric.elc.
2013-11-29 12:59:38 -05:00
Stefan Monnier
25158c76b2 * lisp/electric.el (electric-indent-mode-map): Remove.
(electric-indent-mode): Change the global-map instead.

Fixes: debbugs:15915
2013-11-17 21:01:34 -05:00
Stefan Monnier
feca4e2db9 * lisp/electric.el (electric-indent-just-newline): New command.
(electric-indent-mode-map): New keymap.
(electric-indent-mode, electric-pair-mode, electric-layout-mode):
Re-add :group which weren't redundant.
2013-11-05 22:37:03 -05:00
Stefan Monnier
a35287ea23 * lisp/electric.el (electric-indent-local-mode): New minor mode.
(electric-indent-functions-without-reindent): New var.
(electric-indent-post-self-insert-function): Use it.
* lisp/emacs-lisp/gv.el (buffer-local-value): Add setter.
2013-11-05 21:10:18 -05:00
Stefan Monnier
0ade65b530 * lisp/electric.el (electric-indent-post-self-insert-function):
Only delete trailing whitepsace if it is indeed trailing.

Fixes: debbugs:15767
2013-11-04 15:04:25 -05:00
Stefan Monnier
2abb4e6560 * lisp/electric.el (electric-indent-inhibit): New var.
(electric-indent-post-self-insert-function): Use it.
* lisp/progmodes/python.el (python-mode): Set it.
2013-10-07 14:51:26 -04:00
Juanma Barranquero
57b16162ce Remove references to universal-argument-num-events.
* lisp/autoarg.el (autoarg-kp-digit-argument):
* lisp/electric.el (Electric-command-loop):
* lisp/kmacro.el (kmacro-step-edit-insert):
  Do not set universal-argument-num-events.
2013-09-23 04:58:02 +02:00
Stefan Monnier
102626e225 * lisp/electric.el (electric-pair-mode): Improve interaction with
electric-layout-mode.
(electric-pair-default-inhibit): Don't assume (eq char (char-before)).
(electric-pair-syntax): Use text-mode-syntax-table in comments and strings.
(electric-pair--insert): New function.
(electric-pair-post-self-insert-function): Use it and electric--after-char-pos.
2013-06-19 00:42:32 -04:00
Glenn Morris
51af1aa233 * lisp/electric.el (electric-pair-inhibit-predicate): Add :version. 2013-04-03 20:42:10 -07:00
Stefan Monnier
15c579f08c * lisp/electric.el (electric-pair-inhibit-predicate): New var.
(electric-pair-post-self-insert-function): Use it.
(electric-pair-default-inhibit): New function, extracted from
electric-pair-post-self-insert-function.

Fixes: debbugs:14000
2013-04-01 09:28:19 -04:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Stefan Monnier
c77d37e227 Rework the last delsel/electric fix.
* lisp/delsel.el (delete-selection-helper): Use a function instead of a hook.
(delete-selection-pre-hook): Use use-region-p.
(delete-selection-self-insert-function): Remove.
(self-insert-command): Obey self-insert-uses-region-functions.
(self-insert-iso): Revert to previous setting, since we don't actually
know what that command does.
(delete-selection-self-insert-hooks): Remove.
* lisp/electric.el (electric-pair-delete-selection-self-insert-function):
Rename to electric-pair-will-use-region, return a boolean.
(electric-pair-mode): Adjust accordingly.  Don't require delsel.
2012-10-22 08:43:54 -04:00
Simon Law
b1d39ccce4 * lisp/delsel.el (delete-selection-helper): New function, extracted from
delete-selection-pre-hook.
(delete-selection-pre-hook): Use it.
(delete-selection-self-insert-function): New function.
(delete-selection-self-insert-hooks): New hook.
(self-insert-command, self-insert-iso): Use it.
* lisp/electric.el (electric-pair-syntax): New function, extracted from
electric-pair-post-self-insert-function.
(electric-pair-post-self-insert-function): Use it.
(electric-pair-delete-selection-self-insert-function): New function.
(electric-pair-mode): Require delsel and setup
delete-selection-self-insert-hooks.

Fixes: debbugs:11520
2012-10-21 23:15:44 -04:00
Chong Yidong
b5cf7fc45c Fix electric-pair-mode/delete-selection-mode interaction.
* lisp/electric.el (electric-pair-post-self-insert-function): Fix pair
insertion in empty-region case.

Fixes: debbugs:11520
2012-07-14 13:32:23 +08:00
Stefan Monnier
f58e0fd503 Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 07:51:54 -04:00
Stefan Monnier
cfc7d5da20 * lisp/electric.el (electric-indent-post-self-insert-function): Check that
electric-indent-mode is enabled in current buffer.
2012-04-19 18:02:25 -04:00
Glenn Morris
a075a2c5a6 Doc fixes for electric.el
* lisp/electric.el (electric-indent-mode, electric-pair-mode)
(electric-layout-rules, electric-layout-mode): Doc fixes.
(electric-pair-pairs, electric-pair-skip-self): Add :version tags.

* etc/NEWS: Related edits.
2012-02-08 21:40:41 -05:00
Glenn Morris
e1ac4066d1 Minor-mode doc fixes for ARG behavior
* lisp/completion.el (dynamic-completion-mode):
* lisp/dirtrack.el (dirtrack-debug-mode):
* lisp/electric.el (electric-layout-mode):
* lisp/epa-mail.el (epa-mail-mode, epa-global-mail-mode):
* lisp/face-remap.el (text-scale-mode, buffer-face-mode):
* lisp/iimage.el (iimage-mode):
* lisp/image-mode.el (image-transform-mode):
* lisp/minibuffer.el (completion-in-region-mode):
* lisp/scroll-lock.el (scroll-lock-mode):
* lisp/simple.el (next-error-follow-minor-mode):
* lisp/tar-mode.el (tar-subfile-mode):
* lisp/tooltip.el (tooltip-mode):
* lisp/vcursor.el (vcursor-use-vcursor-map):
* lisp/wid-browse.el (widget-minor-mode):
* lisp/emulation/tpu-edt.el (tpu-edt-mode):
* lisp/emulation/tpu-extras.el (tpu-cursor-free-mode):
* lisp/international/iso-ascii.el (iso-ascii-mode):
* lisp/language/thai-util.el (thai-word-mode):
* lisp/mail/supercite.el (sc-minor-mode):
* lisp/net/goto-addr.el (goto-address-mode):
* lisp/net/rcirc.el (rcirc-multiline-minor-mode, rcirc-track-minor-mode):
* lisp/progmodes/cwarn.el (cwarn-mode):
* lisp/progmodes/flymake.el (flymake-mode):
* lisp/progmodes/glasses.el (glasses-mode):
* lisp/progmodes/hideshow.el (hs-minor-mode):
* lisp/progmodes/pascal.el (pascal-outline-mode):
* lisp/textmodes/enriched.el (enriched-mode):
* lisp/vc/smerge-mode.el (smerge-mode):
Doc fixes (minor mode argument).

* etc/NEWS: Related markup.
2012-02-07 21:12:24 -05:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Paul Eggert
c80e3b4aed Spelling fixes. 2011-12-04 00:02:42 -08:00
Stefan Monnier
6f5e57e773 * lisp/electric.el: Streamline electric-indent's hook.
(electric-indent-chars): Revert to simple list.
(electric-indent-functions): New var.
(electric-indent-post-self-insert-function): Use it.
2011-12-03 00:01:41 -05:00
Stefan Monnier
24f3d7b94b * lisp/electric.el (electric-indent-mode): Fix last change (too optimistic). 2011-11-20 01:29:57 -05:00
Stefan Monnier
65bd19ff8a * lisp/electric.el: Make electric-indent-mode better behaved.
* lisp/electric.el (electric-indent-post-self-insert-function): Make it
possible for a char to only indent in some circumstances.
(electric-indent-mode): Simplify.
2011-11-11 10:55:24 -05:00
Stefan Monnier
0c32508203 * lisp/electric.el (electric-pair-post-self-insert-function): Let user
turn it off buffer-locally.

Fixes: debbugs:9932
2011-11-09 10:10:25 -05:00
Chong Yidong
06e21633a4 Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.

* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 08:54:24 -04:00
Juanma Barranquero
06b605171f lisp/*.el: Lexical-binding cleanup. 2011-04-19 15:44:55 +02:00
Glenn Morris
73b0cd5003 Convert consecutive FSF copyright years to ranges. 2011-01-24 20:08:28 -08:00
Stefan Monnier
74a10be5d3 * lisp/electric.el (electric-indent-post-self-insert-function):
Don't auto-indent for indent-to-left-margin, it's too often
counter-productive.
2011-01-17 21:11:51 -05:00
Glenn Morris
0d9f702fd0 Nuke arch-tags. 2011-01-15 15:16:57 -08:00
Stefan Monnier
77ab81d054 Merge from emacs-23 2011-01-14 12:18:41 -05:00
Glenn Morris
5df4f04cd3 Add 2011 to FSF/AIST copyright years. 2011-01-02 15:50:46 -08:00
Stefan Monnier
a733fc3715 * lisp/electric.el (electric-indent-post-self-insert-function):
Delete trailing newlines even if we don't reindent.
2010-12-07 10:36:08 -05:00
Stefan Monnier
c51bb5d2c2 * lisp/electric.el (electric-pair-pairs): New var.
(electric-pair-post-self-insert-function): Use it.
(electric-layout-post-self-insert-function): Don't insert a before
newline unless it's actually needed.
2010-11-17 21:43:42 -05:00
Stefan Monnier
7100ff9844 * lisp/electric.el (electric-layout-mode): New minor mode.
(electric--after-char-pos): New function.
(electric-indent-post-self-insert-function): Use it.
(electric-layout-rules): New var.
(electric-layout-post-self-insert-function): New function.
(electric-indent-mode): Make them interact better.
2010-11-16 16:14:46 -05:00
Stefan Monnier
2122161f8d * lisp/electric.el (electric-indent-chars): Autoload.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/ruby-mode.el (ruby-mode): Take advantage of it.
(ruby-mode-abbrev-table): Merge initialization and declaration.
2010-10-27 10:26:01 -04:00
Stefan Monnier
6aeafb3437 * lisp/electric.el (electric-indent-post-self-insert-function):
Don't reindent with a sloppy indentation function.
2010-09-05 00:54:58 +02:00
Stefan Monnier
3b843809ca * lisp/electric.el (electricity): New group.
(electric-indent-chars): New var.
(electric-indent-post-self-insert-function): New fun.
(electric-indent-mode): New minor mode.
(electric-pair-skip-self): New custom.
(electric-pair-post-self-insert-function): New function.
(electric-pair-mode): New minor mode.
2010-09-03 15:06:51 +02:00