mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 09:31:39 -05:00
Merge branch 'junk'
Move "scratch notebook" commands/configurables into ein:junk-* namespace.
This commit is contained in:
commit
7eee1e8cda
6 changed files with 89 additions and 33 deletions
|
@ -215,7 +215,7 @@ port or URL of the IPython notebook server.
|
|||
.. el:function:: ein:notebooklist-open
|
||||
.. el:function:: ein:notebooklist-new-notebook
|
||||
.. el:function:: ein:notebooklist-open-notebook-global
|
||||
.. el:function:: ein:notebooklist-new-scratch-notebook
|
||||
.. el:function:: ein:junk-new
|
||||
|
||||
.. el:keymap:: ein:notebooklist-mode-map
|
||||
:exclude: widget-button
|
||||
|
@ -230,7 +230,7 @@ The following keybinds are available in notebook buffers.
|
|||
.. el:keymap:: ein:notebook-mode-map
|
||||
|
||||
.. el:function:: ein:worksheet-delete-cell
|
||||
.. el:function:: ein:notebook-rename-to-scratch-command
|
||||
.. el:function:: ein:junk-rename
|
||||
.. el:function:: ein:notebook-kill-all-buffers
|
||||
.. el:function:: ein:iexec-mode
|
||||
|
||||
|
@ -324,7 +324,7 @@ Notebook
|
|||
.. el:variable:: ein:notebook-querty-timeout-save
|
||||
.. el:variable:: ein:cell-traceback-level
|
||||
.. el:variable:: ein:cell-autoexec-prompt
|
||||
.. el:variable:: ein:scratch-notebook-name-template
|
||||
.. el:variable:: ein:junk-notebook-name-template
|
||||
.. el:variable:: ein:iexec-delay
|
||||
.. el:variable:: ein:complete-on-dot
|
||||
.. el:variable:: ein:output-type-preference
|
||||
|
@ -499,6 +499,10 @@ Change Log
|
|||
v0.2
|
||||
----
|
||||
|
||||
* Rename notion of "scratch notebook" to "junk notebook".
|
||||
This is to avoid confusion with newly added "scratch sheet".
|
||||
Old commands are renamed to :el:symbol:`ein:junk-new` and
|
||||
:el:symbol:`ein:junk-rename`.
|
||||
* Preferred MIME types to be used can be configured using the variable
|
||||
:el:symbol:`ein:output-type-preference`.
|
||||
* HTML content is rendered SHR (Simple HTML Renderer) by default.
|
||||
|
|
|
@ -63,14 +63,6 @@ Notebook server."
|
|||
(const :tag "First value of `ein:url-or-port'" nil))
|
||||
:group 'ein)
|
||||
|
||||
(defcustom ein:scratch-notebook-name-template "_scratch_%Y-%m-%d-%H%M%S_"
|
||||
"Template of scratch notebook name.
|
||||
This value is used from `ein:notebooklist-new-scratch-notebook'
|
||||
and `ein:notebook-rename-to-scratch-command'. This must be a
|
||||
format string which can be passed to `format-time-string'."
|
||||
:type '(string :tag "Format string")
|
||||
:group 'ein)
|
||||
|
||||
(defcustom ein:filename-translations nil
|
||||
"Convert file paths between Emacs and Python process.
|
||||
|
||||
|
@ -123,11 +115,6 @@ pair of TO-PYTHON and FROM-PYTHON."
|
|||
(defun ein:default-url-or-port ()
|
||||
(or ein:default-url-or-port (car ein:url-or-port) 8888))
|
||||
|
||||
(defun ein:scratch-notebook-name ()
|
||||
"Generate new scratch notebook name based on `current-time' and
|
||||
`ein:scratch-notebook-name-template'."
|
||||
(format-time-string ein:scratch-notebook-name-template (current-time)))
|
||||
|
||||
|
||||
|
||||
;;; File name translation (tramp support)
|
||||
|
|
75
lisp/ein-junk.el
Normal file
75
lisp/ein-junk.el
Normal file
|
@ -0,0 +1,75 @@
|
|||
;;; ein-junk.el --- Open a notebook to do random things
|
||||
|
||||
;; Copyright (C) 2012 Takafumi Arakaki
|
||||
|
||||
;; Author: Takafumi Arakaki <aka.tkf at gmail.com>
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; ein-junk.el 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.
|
||||
|
||||
;; ein-junk.el 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 ein-junk.el.
|
||||
;; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ein-notebooklist)
|
||||
|
||||
|
||||
(define-obsolete-variable-alias 'ein:scratch-notebook-name-template
|
||||
'ein:junk-notebook-name-template "0.2.0")
|
||||
|
||||
(defcustom ein:junk-notebook-name-template "junk-%Y-%m-%d-%H%M%S"
|
||||
"Junk notebook name template.
|
||||
This value is used from `ein:notebooklist-new-scratch-notebook'
|
||||
and `ein:notebook-rename-to-scratch-command'. This must be a
|
||||
format string which can be passed to `format-time-string'."
|
||||
:type '(string :tag "Format string")
|
||||
:group 'ein)
|
||||
|
||||
(defun ein:junk-notebook-name ()
|
||||
"Generate new scratch notebook name based on `current-time' and
|
||||
`ein:junk-notebook-name-template'."
|
||||
(format-time-string ein:junk-notebook-name-template (current-time)))
|
||||
|
||||
|
||||
(define-obsolete-function-alias 'ein:notebooklist-new-scratch-notebook
|
||||
'ein:junk-new)
|
||||
|
||||
(defun ein:junk-new ()
|
||||
"Open a notebook to try random thing.
|
||||
Notebook name is determined based on
|
||||
`ein:junk-notebook-name-template'."
|
||||
(interactive)
|
||||
(ein:notebooklist-new-notebook-with-name
|
||||
(ein:junk-notebook-name)
|
||||
(ein:default-url-or-port)))
|
||||
|
||||
|
||||
(define-obsolete-function-alias ' ein:notebook-rename-to-scratch-command
|
||||
'ein:junk-rename)
|
||||
|
||||
(defun ein:junk-rename (name)
|
||||
"Rename the current notebook based on `ein:junk-notebook-name-template'
|
||||
and save it immediately."
|
||||
(interactive
|
||||
(list (read-string "Rename notebook: "
|
||||
(ein:junk-notebook-name))))
|
||||
(ein:notebook-rename-command name))
|
||||
|
||||
(provide 'ein-junk)
|
||||
|
||||
;;; ein-junk.el ends here
|
|
@ -608,14 +608,6 @@ NAME is any non-empty string that does not contain '/' or '\\'."
|
|||
(run-hooks 'ein:notebook-after-rename-hook)))
|
||||
ein:%notebook%))
|
||||
|
||||
(defun ein:notebook-rename-to-scratch-command (name)
|
||||
"Rename notebook based on `ein:scratch-notebook-name-template'
|
||||
and save it immediately."
|
||||
(interactive
|
||||
(list (read-string "Rename notebook: "
|
||||
(ein:scratch-notebook-name))))
|
||||
(ein:notebook-rename-command name))
|
||||
|
||||
(defun ein:notebook-close (notebook)
|
||||
"Close NOTEBOOK and kill its buffer."
|
||||
(let ((ein:notebook-kill-buffer-ask nil))
|
||||
|
@ -985,6 +977,10 @@ Do not use `python-mode'. Use plain mode when MuMaMo is not installed::
|
|||
,@(ein:generate-menu
|
||||
'(("Restart kernel" ein:notebook-restart-kernel-command)
|
||||
("Interrupt kernel" ein:notebook-kernel-interrupt-command))))
|
||||
("Junk notebook"
|
||||
,@(ein:generate-menu
|
||||
'(("Junk this notebook" ein:junk-rename)
|
||||
("Open new junk" ein:junk-new))))
|
||||
;; Misc:
|
||||
,@(ein:generate-menu
|
||||
'(("Open regular IPython console" ein:console-open)
|
||||
|
|
|
@ -256,15 +256,6 @@ This function is called via `ein:notebook-after-rename-hook'."
|
|||
(pop-to-buffer (current-buffer))))
|
||||
(list name)))
|
||||
|
||||
(defun ein:notebooklist-new-scratch-notebook ()
|
||||
"Open a notebook to try random thing.
|
||||
Notebook name is determined based on
|
||||
`ein:scratch-notebook-name-template'."
|
||||
(interactive)
|
||||
(ein:notebooklist-new-notebook-with-name
|
||||
(ein:scratch-notebook-name)
|
||||
(ein:default-url-or-port)))
|
||||
|
||||
(defun ein:notebooklist-delete-notebook-ask (notebook-id name)
|
||||
(when (y-or-n-p (format "Delete notebook %s?" name))
|
||||
(ein:notebooklist-delete-notebook notebook-id name)))
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
(autoload 'ein:iexec-mode "ein-iexec"
|
||||
"Instant cell execution minor mode." t)
|
||||
|
||||
(autoload 'ein:junk-new "ein-junk" nil t)
|
||||
(autoload 'ein:junk-rename "ein-junk" nil t)
|
||||
|
||||
(autoload 'anything-ein-notebook-buffers "ein-helm" nil t)
|
||||
(autoload 'helm-ein-notebook-buffers "ein-helm" nil t)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue