-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from darth10/feature/new-ownership
Tidying up god-mode package
- Loading branch information
Showing
7 changed files
with
108 additions
and
98 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
emacs_version: | ||
- 24.4 | ||
- 24.5 | ||
- 25.1 | ||
- 25.2 | ||
- 25.3 | ||
- 26.1 | ||
- 26.2 | ||
- 26.3 | ||
- snapshot | ||
include: | ||
- emacs_version: snapshot | ||
allow_failure: true | ||
steps: | ||
- uses: purcell/setup-emacs@master | ||
with: | ||
version: ${{ matrix.emacs_version }} | ||
- uses: actions/checkout@v1 | ||
- uses: conao3/setup-cask@master | ||
- name: Install dependencies | ||
run: 'cask install' | ||
- name: Run tests | ||
if: matrix.allow_failure != true | ||
run: 'cask exec ecukes' | ||
- name: Run tests (allow failure) | ||
if: matrix.allow_failure == true | ||
run: 'cask exec ecukes || true' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
(source gnu) | ||
(source melpa) | ||
|
||
(package "god-mode" "2.7.2" "God-like command entering minor mode.") | ||
(package "god-mode" "2.16.0" "God-like command entering minor mode.") | ||
|
||
(development | ||
(depends-on "ecukes") | ||
(depends-on "ansi") | ||
) | ||
(depends-on "ansi")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
;;; god-mode-isearch.el --- God-mode-like behaviour for isearch | ||
;;; god-mode-isearch.el --- God-mode-like behaviour for isearch -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (c) 2014 Chris Done. All rights reserved. | ||
;; Copyright (C) 2014 Chris Done | ||
;; Copyright (C) 2020 Akhil Wali | ||
|
||
;; Author: Chris Done <[email protected]> | ||
;; URL: https://github.com/chrisdone/god-mode | ||
;; Version: 2.16.0 | ||
;; Package-Requires: ((emacs "24.4")) | ||
|
||
;; This file is free software; you can redistribute it and/or modify | ||
;; it under the terms of the GNU General Public License as published by | ||
|
@@ -15,6 +21,10 @@ | |
;; You should have received a copy of the GNU General Public License | ||
;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
;;; Commentary: | ||
|
||
;; See README.md. | ||
|
||
;;; Code: | ||
|
||
;; Recommended use: | ||
|
@@ -31,13 +41,15 @@ | |
"Keymap for modal isearch.") | ||
|
||
(defun god-mode-isearch-activate () | ||
"Switch the isearch-local god-mode." | ||
"Activate God mode in the isearch buffer." | ||
(interactive) | ||
(setq overriding-terminal-local-map god-mode-isearch-map)) | ||
|
||
(defun god-mode-isearch-disable () | ||
"Switch back to regular isearch." | ||
"Deactivate God mode in the isearch buffer." | ||
(interactive) | ||
(setq overriding-terminal-local-map isearch-mode-map)) | ||
|
||
(provide 'god-mode-isearch) | ||
|
||
;;; god-mode-isearch.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
;;; god-mode.el --- God-like command entering minor mode | ||
;;; god-mode.el --- God-like command entering minor mode -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2013 Chris Done | ||
;; Copyright (C) 2013 Magnar Sveen | ||
;; Copyright (C) 2013 Rüdiger Sonderfeld | ||
;; Copyright (C) 2013 Dillon Kearns | ||
;; Copyright (C) 2013 Fabián Ezequiel Gallina | ||
;; Copyright (C) 2020 Akhil Wali | ||
|
||
;; Author: Chris Done <[email protected]> | ||
;; URL: https://github.com/chrisdone/god-mode | ||
;; Version: 2.15.0 | ||
;; Version: 2.16.0 | ||
;; Package-Requires: ((emacs "24.4")) | ||
|
||
;; This file is not part of GNU Emacs. | ||
|
||
|
@@ -60,7 +62,7 @@ | |
vc-annotate-mode | ||
git-commit-mode ; For versions prior to Magit 2.1.0 | ||
magit-popup-mode) | ||
"List of major modes that should not start in god-local-mode." | ||
"List of major modes that should not start with `god-local-mode' enabled." | ||
:group 'god | ||
:type '(function)) | ||
|
||
|
@@ -70,8 +72,8 @@ | |
#'god-git-commit-mode-p | ||
#'god-view-mode-p | ||
#'god-special-mode-p) | ||
"List of predicates checked before enabling god-local-mode. | ||
All predicates must return nil for god-local-mode to start." | ||
"List of predicates checked before enabling `god-local-mode'. | ||
All predicates must return nil for `god-local-mode' to start." | ||
:group 'god | ||
:type '(repeat function)) | ||
|
||
|
@@ -95,28 +97,28 @@ All predicates must return nil for god-local-mode to start." | |
(run-hooks 'god-mode-disabled-hook))) | ||
|
||
(defun god-local-mode-pause () | ||
"Pause god-mode local to the buffer, if it's | ||
enabled. See also `god-local-mode-resume'." | ||
"Pause `god-local-mode' if it is enabled. | ||
See also `god-local-mode-resume'." | ||
(when god-local-mode | ||
(god-local-mode -1) | ||
(setq god-local-mode-paused t))) | ||
|
||
(defun god-local-mode-resume () | ||
"Will re-enable god-mode, if it was active when | ||
`god-local-mode-pause' was called. If not, nothing happens." | ||
"Re-enable `god-local-mode'. | ||
If it was not active when `god-local-mode-pause' was called, nothing happens." | ||
(when (bound-and-true-p god-local-mode-paused) | ||
(setq god-local-mode-paused nil) | ||
(god-local-mode 1))) | ||
|
||
(defvar god-global-mode nil | ||
"Activate God mode on all buffers?") | ||
"Enable `god-local-mode' on all buffers.") | ||
|
||
(defvar god-literal-sequence nil | ||
"Activated after space is pressed in a command sequence.") | ||
"Activated after `god-literal-key' is pressed in a command sequence.") | ||
|
||
;;;###autoload | ||
(defun god-mode () | ||
"Toggle global God mode." | ||
"Toggle global `god-local-mode'." | ||
(interactive) | ||
(setq god-global-mode (not god-global-mode)) | ||
(if god-global-mode | ||
|
@@ -125,7 +127,7 @@ enabled. See also `god-local-mode-resume'." | |
|
||
;;;###autoload | ||
(defun god-mode-all () | ||
"Toggle God mode in all buffers." | ||
"Toggle `god-local-mode' in all buffers." | ||
(interactive) | ||
(let ((new-status (if (bound-and-true-p god-local-mode) -1 1))) | ||
(setq god-global-mode t) | ||
|
@@ -136,7 +138,7 @@ enabled. See also `god-local-mode-resume'." | |
(setq god-global-mode (= new-status 1)))) | ||
|
||
(defun god-mode-maybe-universal-argument-more () | ||
"If god mode is enabled, call `universal-argument-more'." | ||
"If `god-local-mode' is enabled, call `universal-argument-more'." | ||
(interactive) | ||
(if god-local-mode | ||
(call-interactively #'universal-argument-more) | ||
|
@@ -167,25 +169,24 @@ enabled. See also `god-local-mode-resume'." | |
(execute-kbd-macro binding)))) | ||
|
||
(defun god-mode-upper-p (char) | ||
"Is the given char upper case?" | ||
"Check if CHAR is an upper case character." | ||
(and (>= char ?A) | ||
(<= char ?Z) | ||
(/= char ?G))) | ||
|
||
(defun god-mode-lookup-key-sequence (&optional key key-string-so-far) | ||
"Lookup the command for the given `key' (or the next keypress, | ||
if `key' is nil). This function sometimes | ||
recurses. `key-string-so-far' should be nil for the first call in | ||
the sequence." | ||
"Lookup the command for the given KEY (or the next keypress, if KEY is nil). | ||
This function sometimes recurses. | ||
KEY-STRING-SO-FAR should be nil for the first call in the sequence." | ||
(interactive) | ||
(let ((sanitized-key | ||
(god-mode-sanitized-key-string | ||
(or key (read-event key-string-so-far))))) | ||
(god-mode-lookup-command | ||
(key-string-after-consuming-key sanitized-key key-string-so-far)))) | ||
(god-key-string-after-consuming-key sanitized-key key-string-so-far)))) | ||
|
||
(defun god-mode-sanitized-key-string (key) | ||
"Convert any special events to textual." | ||
"Convert any special events in KEY to textual representation." | ||
(cl-case key | ||
(tab "TAB") | ||
(?\ "SPC") | ||
|
@@ -199,9 +200,10 @@ the sequence." | |
(return "RET") | ||
(t (char-to-string key)))) | ||
|
||
(defun key-string-after-consuming-key (key key-string-so-far) | ||
"Interpret god-mode special keys for key (consumes more keys if | ||
appropriate). Append to keysequence." | ||
(defun god-key-string-after-consuming-key (key key-string-so-far) | ||
"Interpret god-mode special keys for KEY. | ||
Consumes more keys if appropriate. | ||
Appends to key sequence KEY-STRING-SO-FAR." | ||
(let ((key-consumed t) (next-modifier "") next-key) | ||
(message key-string-so-far) | ||
(cond | ||
|
@@ -234,8 +236,7 @@ appropriate). Append to keysequence." | |
(concat next-modifier next-key)))) | ||
|
||
(defun god-mode-lookup-command (key-string) | ||
"Execute extended keymaps such as C-c, or if it is a command, | ||
call it." | ||
"Execute extended keymaps in KEY-STRING, or call it if it is a command." | ||
(let* ((key-vector (read-kbd-macro key-string t)) | ||
(binding (key-binding key-vector))) | ||
(cond ((commandp binding) | ||
|
@@ -248,18 +249,20 @@ call it." | |
|
||
;;;###autoload | ||
(defun god-mode-maybe-activate (&optional status) | ||
"Activate God mode locally on individual buffers when appropriate." | ||
"Activate `god-local-mode' on individual buffers when appropriate. | ||
STATUS is passed as an argument to `god-mode-activate'." | ||
(when (not (minibufferp)) | ||
(god-mode-activate status))) | ||
|
||
(defun god-mode-activate (&optional status) | ||
"Activate God mode locally on individual buffers when appropriate." | ||
"Activate `god-local-mode' on individual buffers when appropriate. | ||
STATUS is passed as an argument to `god-local-mode'." | ||
(when (and god-global-mode | ||
(god-passes-predicates-p)) | ||
(god-local-mode (if status status 1)))) | ||
|
||
(defun god-exempt-mode-p () | ||
"Return non-nil if major-mode is exempt. | ||
"Return non-nil if `major-mode' is exempt. | ||
Members of the `god-exempt-major-modes' list are exempt." | ||
(memq major-mode god-exempt-major-modes)) | ||
|
||
|
@@ -272,15 +275,15 @@ Members of the `god-exempt-major-modes' list are exempt." | |
(t nil)))) | ||
|
||
(defun god-comint-mode-p () | ||
"Return non-nil if major-mode is child of comint-mode." | ||
"Return non-nil if `major-mode' is derived from `comint-mode'." | ||
(god-mode-child-of-p major-mode 'comint-mode)) | ||
|
||
(defun god-special-mode-p () | ||
"Return non-nil if major-mode is special or a child of special-mode." | ||
"Return non-nil if `major-mode' is special or derived from `special-mode'." | ||
(eq (get major-mode 'mode-class) 'special)) | ||
|
||
(defun god-view-mode-p () | ||
"Return non-nil if view-mode is enabled in current buffer." | ||
"Return non-nil if variable `view-mode' is non-nil in current buffer." | ||
view-mode) | ||
|
||
(defun god-git-commit-mode-p () | ||
|