This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This is from simple.el of Bzr-110657. Looks normal? Please take a | |
;; look at the second if statement. What's the condition, the | |
;; consequent, and the alternative? Once you thought about that, count | |
;; parens. (Or paste it over to another buffer and actually let Emacs | |
;; indent it.) | |
(defun count-lines (start end) | |
"Return number of lines between START and END. | |
This is usually the number of newlines between them, | |
but can be one more if START is not equal to END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun fc/comint-send-as-input (buffer input) | |
"Send INPUT to the comint process in BUFFER." | |
(with-current-buffer buffer | |
(let* ((process (get-buffer-process buffer)) | |
(beg (process-mark process)) | |
(end (point-max)) | |
(old (buffer-substring beg end))) | |
(delete-region beg end) | |
(goto-char beg) | |
(insert input) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun test-filter (process string) | |
(with-current-buffer (process-buffer process) | |
(insert "Filter: " string))) | |
(defun test-sentinel (process event) | |
(with-current-buffer (process-buffer process) | |
(insert "Sentinel: " event))) | |
(let ((buf (get-buffer-create "*Test*"))) | |
(make-network-process :name "*Test*" | |
:buffer buf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun electric-pair-post-self-insert-function () | |
(let* ((syntax (and (eq (char-before) last-command-event) ; Sanity check. | |
(electric-pair-syntax last-command-event))) | |
;; FIXME: when inserting the closer, we should maybe use | |
;; self-insert-command, although it may prove tricky running | |
;; post-self-insert-hook recursively, and we wouldn't want to trigger | |
;; blink-matching-open. | |
(closer (if (eq syntax ?\() | |
(cdr (or (assq last-command-event electric-pair-pairs) | |
(aref (syntax-table) last-command-event))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ngz/copy-buffer (oldbuf new-name) | |
"Create a new buffer named NEW-NAME as a copy of OLDBUF. | |
Will copy the contents and all buffer-local variables. | |
Returns the newly-created buffer" | |
(let ((newbuf (get-buffer-create new-name))) | |
(with-current-buffer oldbuf | |
(copy-to-buffer newbuf (point-min) (point-max))) | |
(with-current-buffer newbuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ngz/copy-buffer (oldbuf new-name) | |
"Create a new buffer named NEW-NAME as a copy of OLDBUF. | |
Will copy the contents and all buffer-local variables. | |
Returns the newly-created buffer" | |
(let ((newbuf (get-buffer-create new-name))) | |
(with-current-buffer oldbuf | |
(copy-to-buffer newbuf (point-min) (point-max))) | |
(with-current-buffer newbuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ngz/copy-buffer (oldbuf new-name) | |
"Create a new buffer named NEW-NAME as a copy of OLDBUF. | |
Will copy the contents and all buffer-local variables. | |
Returns the newly-created buffer" | |
(let ((newbuf (get-buffer-create new-name))) | |
(with-current-buffer oldbuf | |
(copy-to-buffer newbuf (point-min) (point-max))) | |
(with-current-buffer newbuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ngz/copy-buffer (oldbuf new-name) | |
"Create a new buffer named NEW-NAME as a copy of OLDBUF. | |
Will copy the contents and all buffer-local variables. | |
Returns the newly-created buffer" | |
(let ((newbuf (get-buffer-create new-name))) | |
(with-current-buffer oldbuf | |
(copy-to-buffer newbuf (point-min) (point-max))) | |
(with-current-buffer newbuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ngz/copy-buffer (oldbuf new-name) | |
"Create a new buffer named NEW-NAME as a copy of OLDBUF. | |
Will copy the contents and all buffer-local variables. | |
Returns the newly-created buffer" | |
(let ((newbuf (get-buffer-create new-name))) | |
(with-current-buffer oldbuf | |
(copy-to-buffer newbuf (point-min) (point-max))) | |
(with-current-buffer newbuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Here is a complete example of the settings you would use for | |
;; iPython 0.11: | |
;; (setq | |
;; python-shell-interpreter "ipython" | |
;; python-shell-interpreter-args "" | |
;; python-shell-prompt-regexp "In \\[[0-9]+\\]: " | |
;; python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: " | |
;; python-shell-completion-setup-code | |
;; "from IPython.core.completerlib import module_completion" |