Compare commits

...

3 commits

Author SHA1 Message Date
Andrea Corallo
72e2c1e6e6 Add 'modern-mode' command line option
* src/emacs.c (standard_args): Add: '-m' '-modern' '--modern'
	cmd line option.

	* lisp/startup.el (command-line-1): Handle modern-mode cmd line
	option.
2020-09-15 16:21:11 +02:00
Andrea Corallo
66a5fa931c * Add new global minor mode 'modern-mode'
* lisp/modern-mode.el: New file implementing a new global minor
	mode to enable a small collection of non invasive modern settings.
2020-09-15 16:12:50 +02:00
Andrea Corallo
c3b60010f9 * lisp/windmove.el (windmove-remove-keybindings): New function. 2020-09-15 16:12:41 +02:00
4 changed files with 70 additions and 1 deletions

54
lisp/modern-mode.el Normal file
View file

@ -0,0 +1,54 @@
;;; modern-mode.el --- collection of non invasive modern settings -*- lexical-binding: t -*-
;; Copyright (C) 2020 Free Software Foundation, Inc.
;; Author: Andrea Corallo <akrl@sdf.org>
;; Version: 0.1
;; Created: 2020-09-15
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; A minimal collection of non invasive 'modern' settings trying to
;; make Emacs more appealing/easy to new comers.
;;; Code:
(defgroup modern-mode nil
"A conservative collection of modern settings."
:group 'convenience)
;;;###autoload
(define-minor-mode modern-mode
"Toggle modern mode in all buffers."
:global t :group 'modern-mode
(let ((arg (if modern-mode 1 -1)))
(column-number-mode arg)
(delete-selection-mode arg)
(fido-mode arg)
(global-auto-revert-mode arg)
(show-paren-mode arg)
(winner-mode arg))
(if modern-mode
(progn
(windmove-default-keybindings '(shift))
(global-set-key (kbd "C-x C-b") 'ibuffer))
(windmove-remove-keybindings)
(global-set-key (kbd "C-x C-b") 'list-all-buffers)))
(provide 'modern-mode)
;;; modern-mode.el ends here

View file

@ -2363,7 +2363,8 @@ A fancy display is used on graphic displays, normal otherwise."
(longopts
(append '("--funcall" "--load" "--insert" "--kill"
"--directory" "--eval" "--execute" "--no-splash"
"--find-file" "--visit" "--file" "--no-desktop")
"--find-file" "--visit" "--file" "--no-desktop"
"--modern")
(mapcar (lambda (elt) (concat "-" (car elt)))
command-switch-alist)))
(line 0)
@ -2514,6 +2515,9 @@ nil default-directory" name)
(error "File name omitted from `-insert' option"))
(insert-file-contents (command-line-normalize-file-name tem)))
((member argi '("-m" "-modern"))
(modern-mode 1))
((equal argi "-kill")
(kill-emacs t))

View file

@ -440,6 +440,15 @@ Default value of MODIFIERS is `shift'."
(global-set-key (vector (append modifiers '(up))) 'windmove-up)
(global-set-key (vector (append modifiers '(down))) 'windmove-down))
;;;###autoload
(defun windmove-remove-keybindings ()
"Restore default keybindings touched by `windmove-default-keybindings'."
(interactive)
(global-set-key (kbd "S-<right>") 'right-char)
(global-set-key (kbd "S-<left>") 'left-char)
(global-set-key (kbd "S-<up>") 'previous-line)
(global-set-key (kbd "S-<down>") 'next-line))
;;; Directional window display and selection

View file

@ -2130,6 +2130,8 @@ static const struct standard_args standard_args[] =
{ "-color", "--color", 5, 0},
{ "-no-splash", "--no-splash", 3, 0 },
{ "-no-desktop", "--no-desktop", 3, 0 },
{ "-m", "--modern", 0, 0 },
{ "-modern", 0, 0, 0 },
/* The following two must be just above the file-name args, to get
them out of our way, but without mixing them with file names. */
{ "-temacs", "--temacs", 1, 1 },