I am working on a very old Emacs version (23.2.1). I am trying to bind
C-C C-i to an interactive command without luck.
The command selects code regions delimited between two lines that start with
##. It works well when I call it interactively (
M-x python-select-cell), but the keybinding does not work in Python buffers:
(defun python-inside-comment-p () (save-excursion (beginning-of-line 1) (looking-at "^#"))) (defun python-select-cell () (interactive) (goto-char (if (re-search-backward "^\\s-*##[^#]" nil t) (match-end 0) (point-min))) (while (and (python-inside-comment-p) (eq 0 (forward-line 1))) nil) (set-mark (point)) (goto-char (if (re-search-forward "^\\s-*\\(##[^#]\\)" nil t) (- (match-beginning 1) 2) (point-max))))
# Binding (global-set-key (kbd "C-c C-i") 'python-select-cell)
I have also tried setting up a hook without luck
(add-hook 'python-mode-hook #'(lambda () (global-set-key (kbd "C-C C-i") 'python-select-cell)))
What could be going on?