Skip to content

Commit

Permalink
Default filename for pu:save-layout and pu:load-layout prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
Bar Magal committed Feb 8, 2015
1 parent 2c1c347 commit 36038e1
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 117 deletions.
74 changes: 0 additions & 74 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,77 +92,3 @@ Caveats
reports and code contributions are very welcome, and may help with
coming up with a more complete solution for integrating features with
Purpose.


TODO List
=========

Here are listed tasks that should be completed in the future. You are
welcome to contribute and complete any of the tasks below. The marks
[#A], [#B] and [#C] note the importance of a task.

Version 1.0 Requirements
------------------------

Version 1.0 will not be considered ready until these tasks are
completed.

- [DONE] [#A] implement function pu:find-file

- [DONE] [#A] regexp support for purpose detection (implement
pu:buffer-purpose-name-regexp)

- [DONE] [#B] prefix-overload (overload commands on same key, with different
prefix arguments)

- [#B] make pu:load-layout and pu:save-layout prompt for filename when
called interactively

- [DONE] [#B] set good key-bindings for Purpose's commands

Not Version-Specific
--------------------

Tasks that should be done, but not necessarily for a specific version.

- [DONE] [#C] display window purpose in modeline

- [#A] frame support: design and write frame-related behavior and code

- [#A] consider smarter function-call decision in pu:action-function

Which function to use, and how to call it (pu:switch-buffer,
pu:pop-buffer). Pending more usage-experience, suggestions and
bug-reports.

- [#B] pu:switch-buffer-with-same-purpose

Like pu:switch-buffer, but choice is limited to buffers with the same
purpose as the current buffer.

- [#B] make prompts better (more like IDO, more feature-rich)
Currently, the prompts of Purpose's commands don't have as much
features as IDO prompts have. Maybe there is a way to get all of the
IDO's benefits, and not only its nice completion.

- [#B] automatic tests

- [#B] adapt variables for customize

- [#B] add Purpose to a package repository (MELPA?)

- [MAYBE] [#C] improve/change default configuration

- [#C] refactor code (make it nicer and better)

This task doesn't really have an end.

- [MAYBE] [#C] add function delete-non-dedicated-windows

Integration With Other Features
-------------------------------

A list of features which need to be integrated with Purpose. This list is expected
to grow, might become a check-list of sorts.

- <TBD>
2 changes: 1 addition & 1 deletion pu-configuration.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Bar Magal (2015)
;; Package: purpose
;; Version: 0.1.2
;; Version: 1.0

;;; Commentary:
;; This file contains functions for changing Purpose's configuration.
Expand Down
4 changes: 3 additions & 1 deletion pu-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Bar Magal (2015)
;; Package: purpose
;; Version: 0.1.2
;; Version: 1.0

;;; Commentary:
;; This file contains core functions to be used by other parts of
Expand All @@ -15,6 +15,8 @@
(defvar default-purpose 'general
"The default purpose for buffers which didn't get another purpose.")

(defconst pu:version "1.0"
"Purpose's version.")


;;; utilities
Expand Down
18 changes: 11 additions & 7 deletions pu-layout.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Bar Magal (2015)
;; Package: purpose
;; Version: 0.1.2
;; Version: 1.0

;;; Commentary:
;; This file contains function for saving and loading the entire window
Expand Down Expand Up @@ -195,23 +195,27 @@ The height is never given in pixels, but in text size
(pu:set-window-properties layout)
(pu:set-layout-1 layout (selected-window))))

;;TODO: when called interactively, prompt for filename with default
(defun pu:save-layout (&optional filename)
"Save current layout to file FILENAME. If FILENAME is nil, use
`pu:default-layout-file' instead."
(interactive)
;;(interactive "[PU] Save layout to file: " nil pu:default-layout-file)
(interactive
(list (read-file-name "[PU] Save layout to file: "
(file-name-directory pu:default-layout-file)
nil nil
(file-name-nondirectory pu:default-layout-file))))
(with-temp-file (or filename pu:default-layout-file)
;; "%S" - print as S-expression - this allows us to read the value with
;; `read' later in `pu:load-layout'
(insert (format "%S" (pu:get-layout)))))

;;TODO: when called interactively, prompt for filename with default
(defun pu:load-layout (&optional filename)
"Load layout from file FILENAME. If FILENAME is nil, use
`pu:default-layout-file' instead."
(interactive)
;;(interactive "[PU] Load layout from file: " nil pu:default-layout-file)
(interactive
(list (read-file-name "[PU] Load layout from file: "
(file-name-directory pu:default-layout-file)
nil nil
(file-name-nondirectory pu:default-layout-file))))
(pu:set-layout
(with-temp-buffer
(insert-file-contents (or filename pu:default-layout-file))
Expand Down
2 changes: 1 addition & 1 deletion pu-prefix-overload.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Bar Magal (2015)
;; Package: purpose
;; Version: 0.1.2
;; Version: 1.0

;;; Commentary:
;; This file contains functions and macros for using the same
Expand Down
2 changes: 1 addition & 1 deletion pu-switch.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Bar Magal (2015)
;; Package: purpose
;; Version: 0.1.2
;; Version: 1.0

;;; Commentary:
;; This file contains functions for switching buffers in a way that
Expand Down
6 changes: 2 additions & 4 deletions purpose.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Author: Bar Magal (2015)
;; Package: purpose
;; Version: 0.1.2
;; Version: 1.0

;;; Commentary:

Expand Down Expand Up @@ -105,9 +105,7 @@
;; "C-x k")
(define-key map (kbd "C-x j") #'quit-window)

;; We use "C-c ," for compatibility with key-binding conventions and
;; because its the same as Emacs plugin E2WM, which probably won't
;; be used together with Purpose
;; We use "C-c ," for compatibility with key-binding conventions
(define-key map (kbd "C-c ,") #'purpose-mode-prefix-map)
(define-prefix-command 'purpose-mode-prefix-map)
(define-key purpose-mode-prefix-map (kbd "o") #'pu:switch-buffer)
Expand Down
28 changes: 0 additions & 28 deletions todo.org

This file was deleted.

0 comments on commit 36038e1

Please sign in to comment.