Skip to content

Commit

Permalink
Merge pull request weirdNox#42 from org-noter/feature/override-pdfvie…
Browse files Browse the repository at this point in the history
…w-keybindings

override annoying pdf-view-mode and doc-view-mode keybindings (`C-c C-c` and `C-c C-x`)
  • Loading branch information
petermao committed Jun 28, 2023
2 parents 1fbf598 + 652521d commit f9710c9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
17 changes: 17 additions & 0 deletions modules/org-noter-pdf.el
Original file line number Diff line number Diff line change
Expand Up @@ -499,5 +499,22 @@ 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")
(defun org-noter-pdf--execute-CcCc-in-notes ()
"Override C-c C-c in pdf document buffer."
(interactive)
(select-window (org-noter--get-notes-window))
(org-ctrl-c-ctrl-c)))

(define-key org-noter-doc-mode-map (kbd "C-c C-x")
(defun org-noter-pdf--execute-CcCx-in-notes ()
"Override C-c C-x <event> in pdf document 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)))))

(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 f9710c9

Please sign in to comment.