Skip to content

Commit

Permalink
Merge remote-tracking branch 'org-noter/feature/override-pdfview-keyb…
Browse files Browse the repository at this point in the history
…indings' into dev
  • Loading branch information
petermao committed Jun 12, 2023
2 parents e7d7adc + 7b015ba commit b157534
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
16 changes: 16 additions & 0 deletions modules/org-noter-pdf.el
Original file line number Diff line number Diff line change
Expand Up @@ -499,5 +499,21 @@ current heading inherit the COLUMN_EDGES property."
(select-window (org-noter--get-notes-window))
(org-entry-put nil "COLUMN_EDGES" (format "%s" (princ edge-list)))))

;;; override some deleterious keybindings in pdf-view-mode.
(define-key org-noter-doc-mode-map (kbd "C-c C-c")
(lambda ()
(interactive)
(select-window (org-noter--get-notes-window))
(org-ctrl-c-ctrl-c)))

(defun org-noter-pdf--execute-CxCc-in-notes ()
"Execute C-c C-x prefixed command in notes buffer."
(interactive)
(let ((this-CxCc-cmd (vector (read-event))))
(select-window (org-noter--get-notes-window))
(execute-kbd-macro
(vconcat (kbd "C-c C-x") this-CxCc-cmd))))
(define-key org-noter-doc-mode-map (kbd "C-c C-x") 'org-noter-pdf--execute-CxCc-in-notes)

(provide 'org-noter-pdf)
;;; org-noter-pdf.el ends here
24 changes: 22 additions & 2 deletions tests/org-noter-pdf-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,30 @@
(expect (string-match "\\:HIGHLIGHT\\:" (buffer-string)) :not :to-be nil)
(expect (string-match (format "%s" expected-highlight-info) (buffer-string)) :not :to-be nil)
)
)
)
)
)

))
(describe "pdf keybinding overrides"
(it "C-c C-c called from a PDF document executes in the notes buffer"
;; open `org-noter' session with PDF and notes

)
;; execute `C-c C-c' from document buffer

;; check that current window is notes-window, check that
;; last command was `org-ctrl-c-ctrl-c'
)

(it "C-c C-x <event> called from a PDF document executes in the notes buffer"
;; open `org-noter' session with PDF and notes

;; execute `C-c C-x <event>' from document buffer, where
;; <event> \in {C-b, C-v, maybe a few others}

;; check that current window is notes-window, check that
;; last command corresponds to the keybinding of C-c C-x
;; <event>.
)
)
)

0 comments on commit b157534

Please sign in to comment.