Skip to content

Commit

Permalink
remove obsolete name arg to defclass constructor warning
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Dec 6, 2024
1 parent 1777362 commit 1ac49ca
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 44 deletions.
50 changes: 24 additions & 26 deletions test/configuration-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,25 @@ hash tables for the uncompiled alists."
This tests that `purpose-compile-extended-configuration' creates the
correct hash tables for the uncompiled alists."
(purpose-with-empty-config
(let
((purpose-extended-conf
(purpose-conf "test"
:mode-purposes '((prog-mode . edit)
(dired-mode . dired))
:name-purposes '(("editor" . edit)
("foo" . bar))
:regexp-purposes '(("^\\*" . common)))))
(purpose-set-extension-configuration :test purpose-extended-conf)
(should (purpose-set-equal-p (hash-table-keys purpose--extended-mode-purposes) '(dired-mode prog-mode)))
(should (purpose-set-equal-p (hash-table-values purpose--extended-mode-purposes) '(dired edit)))
(should (purpose-set-equal-p (hash-table-keys purpose--extended-name-purposes) '("foo" "editor")))
(should (purpose-set-equal-p (hash-table-values purpose--extended-name-purposes) '(bar edit)))
(should (purpose-set-equal-p (hash-table-keys purpose--extended-regexp-purposes) '("^\\*")))
(should (purpose-set-equal-p (hash-table-values purpose--extended-regexp-purposes) '(common))))
(let (purpose-extended-configuration)
(purpose-compile-extended-configuration)
(should (equal (hash-table-count purpose--extended-mode-purposes) 0))
(should (equal (hash-table-count purpose--extended-name-purposes) 0))
(should (equal (hash-table-count purpose--extended-regexp-purposes) 0)))))
(let
((purpose-extended-conf
(purpose-conf :mode-purposes '((prog-mode . edit)
(dired-mode . dired))
:name-purposes '(("editor" . edit)
("foo" . bar))
:regexp-purposes '(("^\\*" . common)))))
(purpose-set-extension-configuration :test purpose-extended-conf)
(should (purpose-set-equal-p (hash-table-keys purpose--extended-mode-purposes) '(dired-mode prog-mode)))
(should (purpose-set-equal-p (hash-table-values purpose--extended-mode-purposes) '(dired edit)))
(should (purpose-set-equal-p (hash-table-keys purpose--extended-name-purposes) '("foo" "editor")))
(should (purpose-set-equal-p (hash-table-values purpose--extended-name-purposes) '(bar edit)))
(should (purpose-set-equal-p (hash-table-keys purpose--extended-regexp-purposes) '("^\\*")))
(should (purpose-set-equal-p (hash-table-values purpose--extended-regexp-purposes) '(common))))
(let (purpose-extended-configuration)
(purpose-compile-extended-configuration)
(should (equal (hash-table-count purpose--extended-mode-purposes) 0))
(should (equal (hash-table-count purpose--extended-name-purposes) 0))
(should (equal (hash-table-count purpose--extended-regexp-purposes) 0)))))


(ert-deftest purpose-test-compile-default-config ()
Expand Down Expand Up @@ -129,10 +128,10 @@ correct hash tables."
See `purpose-set-extension-configuration' and
`purpose-del-extension-configuration'."
(purpose-with-empty-config
(should-error (purpose-set-extension-configuration 'foo (purpose-conf "foo")))
(purpose-set-extension-configuration :foo (purpose-conf "foo"))
(should-error (purpose-del-extension-configuration 'foo))
(purpose-del-extension-configuration :foo)))
(should-error (purpose-set-extension-configuration 'foo (purpose-conf)))
(purpose-set-extension-configuration :foo (purpose-conf))
(should-error (purpose-del-extension-configuration 'foo))
(purpose-del-extension-configuration :foo)))

(ert-deftest purpose-test-temp-config-1 ()
"Test macros for changing the purpose configuration temporarily.
Expand Down Expand Up @@ -170,8 +169,7 @@ This one tests `purpose-with-additional-purposes'."
(message "Testing purpose-set-extension-configuration ...")
(purpose-set-extension-configuration
:python
(purpose-conf "py"
:mode-purposes '((python-mode . python)
(purpose-conf :mode-purposes '((python-mode . python)
(inferior-python-mode . interpreter))))
(should (purpose-set-equal-p (hash-table-keys purpose--extended-mode-purposes) '(inferior-python-mode python-mode)))
(should (purpose-set-equal-p (hash-table-values purpose--extended-mode-purposes) '(interpreter python)))
Expand Down
9 changes: 3 additions & 6 deletions window-purpose-fixes.el
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ window-purpose."

;;; Helm's buffers should be ignored, and they should have their own purpose
(defvar purpose--helm-conf
(purpose-conf "helm"
:regexp-purposes '(("^\\*Helm" . helm)
(purpose-conf :regexp-purposes '(("^\\*Helm" . helm)
("^\\*helm" . helm)))
"Purpose configuration for helm.")
(defun purpose--fix-helm ()
Expand Down Expand Up @@ -233,7 +232,7 @@ When `purpose--active-p' is nil, call original `neo-global--create-window'."
;; `purpose--special-action-sequence' will try to call it)
(purpose-set-extension-configuration
:neotree
(purpose-conf "Neotree" :name-purposes `((,neo-buffer-name . Neotree))))
(purpose-conf :name-purposes `((,neo-buffer-name . Neotree))))
(add-to-list 'purpose-special-action-sequences
'(Neotree purpose-display-reuse-window-buffer
purpose-display-reuse-window-purpose
Expand Down Expand Up @@ -321,7 +320,6 @@ Don't call this function before `popwin' is loaded."
(purpose-set-extension-configuration
:guide-key
(purpose-conf
"guide-key"
:name-purposes `((,guide-key/guide-buffer-name . guide-key))))))


Expand All @@ -336,7 +334,6 @@ Don't call this function before `popwin' is loaded."
(purpose-set-extension-configuration
:which-key
(purpose-conf
"which-key"
:name-purposes `((,which-key-buffer-name . which-key))))))


Expand Down Expand Up @@ -369,7 +366,7 @@ Don't call this function before `popwin' is loaded."
(with-eval-after-load 'zone
(purpose-set-extension-configuration
:zone
(purpose-conf "zone" :name-purposes '(("*zone*" . Zone))))
(purpose-conf :name-purposes '(("*zone*" . Zone))))
(add-to-list 'purpose-special-action-sequences
'(Zone display-buffer-same-window))))

Expand Down
17 changes: 6 additions & 11 deletions window-purpose-x.el
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ All windows are purpose-dedicated.")
;; the name arg ("purpose-x-code1") is necessary for Emacs 24.5 and older
;; (omitting it produces an "Invalid slot name" error)
(defvar purpose-x-code1-purpose-config
(purpose-conf "purpose-x-code1"
:mode-purposes
(purpose-conf :mode-purposes
'((ibuffer-mode . buffers)
(dired-mode . dired)
(imenu-list-major-mode . ilist))))
Expand Down Expand Up @@ -191,19 +190,15 @@ imenu."
;;; - `purpose-x-magit-off'

(defvar purpose-x-magit-single-conf
(purpose-conf "magit-single"
;; using `magit' as a condition in
;; `purpose-special-action-sequences' is interpreted
;; as a predicate function (for buffer's without a
;; `magit' purpose). `Magit' doesn't have the same
;; problem (no function is named Magit), so that's why
;; we call the purpose `Magit' and not `magit'.
:mode-purposes '((magit-mode . Magit)))
;; using `magit' as a condition in `purpose-special-action-sequences' is
;; interpreted as a predicate function (for buffer's without a `magit'
;; purpose). `Magit' doesn't have the same problem (no function is named
;; Magit), so that's why we call the purpose `Magit' and not `magit'.
(purpose-conf :mode-purposes '((magit-mode . Magit)))
"Configuration that gives each magit major mode the same purpose.")

(defvar purpose-x-magit-multi-conf
(purpose-conf
"magit-multi"
:mode-purposes '((magit-diff-mode . magit-diff)
(magit-status-mode . magit-status)
(magit-log-mode . magit-log)
Expand Down
2 changes: 1 addition & 1 deletion window-purpose.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; Version: 1.8.1
;; Keywords: frames
;; Homepage: https://github.com/bmag/emacs-purpose
;; Package-Requires: ((emacs "24.4") (let-alist "1.0.3") (imenu-list "0.1"))
;; Package-Requires: ((emacs "25.1") (let-alist "1.0.3") (imenu-list "0.1"))

;; This file is not part of GNU Emacs.

Expand Down

0 comments on commit 1ac49ca

Please sign in to comment.