Skip to content

Commit

Permalink
Automatically prompt for problem number when opening input/output files
Browse files Browse the repository at this point in the history
  • Loading branch information
bcc32 committed Dec 14, 2023
1 parent 61c5272 commit f85dfe4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions elisp/advent-of-code.el
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ Pass REST to `request'."
"AoC Input"
"Mode for problem input buffers."
:group 'advent-of-code
(auto-revert-mode))
(auto-revert-mode)
(advent-of-code--problem-number))

(define-key advent-of-code-input-mode-map (kbd "C-c C-c") 'advent-of-code-input-revert-to-real)

(defvar-local advent-of-code--problem-number nil
"The problem number associated with this buffer.")
(put 'advent-of-code--problem-number 'permanent-local t)

;; FIXME: call this first
(defun advent-of-code--problem-number ()
"Return the value of `advent-of-code--problem-number', prompting if nil."
(or advent-of-code--problem-number
Expand Down Expand Up @@ -125,6 +125,7 @@ Pass REST to `request'."
"Mode for solution output buffers."
:group 'advent-of-code
(auto-revert-mode)
(advent-of-code--problem-number)
(add-hook 'after-revert-hook 'advent-of-code-copy-buffer-contents-to-clipboard))

;;;###autoload
Expand Down

0 comments on commit f85dfe4

Please sign in to comment.