Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Apr 23, 2021
1 parent 87c9902 commit 2e117ca
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/workgroups2.el
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,6 @@ If not - try to go to the parent dir and do the same."
(h . wg-pickel-hash-table-link-deserializer))
"Alist mapping type keys to link deserialization functions.")



;;; errors and predicates

(put 'wg-pickel-unpickelable-type-error
'error-conditions
'(error wg-pickel-errors wg-pickel-unpickelable-type-error))
Expand Down Expand Up @@ -2247,11 +2243,8 @@ Or scream unless NOERROR."
(run-hooks 'wg-after-switch-to-workgroup-hook))
(when current (pop wg-deactivation-list))))))

(defun wg-create-workgroup (name &optional blank)
"Create and add a workgroup named NAME.
Optional argument BLANK non-nil (set interactively with a prefix
arg) means use a blank, one window window-config. Otherwise use
the current window-configuration."
(defun wg-create-workgroup (name)
"Create and add a workgroup named NAME."
(interactive (list (wg-read-new-workgroup-name) current-prefix-arg))

(unless (file-exists-p (wg-get-session-file))
Expand All @@ -2265,7 +2258,7 @@ the current window-configuration."
(setf (wg-session-file-name session) wg-session-file)
(wg-reset-internal (wg-unpickel-session-parameters session))))

(wg-switch-to-workgroup-internal (wg-make-and-add-workgroup name blank))
(wg-switch-to-workgroup-internal (wg-make-and-add-workgroup name))

;; save the session file in real time
(wg-save-session)
Expand Down Expand Up @@ -2405,15 +2398,13 @@ Ask to overwrite if a workgroup with the same name exists."
(error "Cancelled"))))
(wg-add-workgroup workgroup))

(defun wg-make-and-add-workgroup (name &optional blank)
(defun wg-make-and-add-workgroup (name)
"Create a workgroup named NAME with current `window-tree'.
If BLANK - then just scratch buffer.
Add it with `wg-check-and-add-workgroup'."
(wg-check-and-add-workgroup
(wg-make-workgroup
:name name
:base-wconfig (if blank (wg-make-blank-wconfig)
(wg-current-wconfig)))))
:base-wconfig (wg-current-wconfig))))

(defun wg-get-workgroup-create (workgroup)
"Return the workgroup specified by WORKGROUP, creating a new one if needed.
Expand Down

0 comments on commit 2e117ca

Please sign in to comment.