EDIT: I closed and reopened Emacs again and the same behavior happened. But this time the text inserted was from my last kill or M-w
—(add-hook 'before-save-hook 'time-stamp)
—to copy it to the system clipboard for the purposes of writing the last lines of my question. So it appears to be more a Mac OS X copy-paste thing than a problem with org-special-edit
. Still annoying and any help would be appreciated!
ORIGINAL QUESTION: This might be something of a longshot. I am using Emacs 25.0.95 with Org 8.2.10 on OS X Yosemite. I have my init file in an .org
file. Lately I have begun to find the contents of org source buffers (the ones that you open at point with C-c '
and save and exit with C-c '
) make their way into another location in the original org buffer. Just now it happened after making a few edits to my configuration of zenburn-theme
. I hit C-c '
for org-edit-special
, set up zenburn-theme
how I wanted it, and hit C-c '
again. Then I closed Emacs to reload the init and completely refresh the way the was theme displaying. So I started Emacs up again, and it loads everything OK; yet when I opened my init file again, I find that the file has been somehow edited—in fact, the text I saved with org-edit-special
has inserted itself towards the top of my init file. So where originally I had this—
#+BEGIN_SRC emacs-lisp :tangle yes
;; set up 'package
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
;; bootstrap 'use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; load 'use-package dependencies: 'bind-key and 'diminish
(require 'bind-key) ; (bundled with `use-package')
(use-package diminish
:ensure t)
#+END_SRC
—the contents of my last org-edit-special
buffer (from last session)—
(use-package zenburn-theme
:ensure t
:config
;; customize zenburn faces (http://emacs.stackexchange.com/a/17962)
(zenburn-with-color-variables
(custom-theme-set-faces
'zenburn
;; change some org-mode faces to make org-blocks more legible à la leuven-theme
;; (https://github.com/bbatsov/zenburn-emacs/pull/175/commits/0c27021b8708464236b78a40546971279d5ae404)
`(org-block ((t (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
`(org-block-background ((t (:background ,zenburn-bg+1))))
`(org-block-begin-line ((t (:foreground ,zenburn-fg :background ,zenburn-bg+05 :underline ,zenburn-bg))))
`(org-block-end-line ((t (:foreground ,zenburn-fg :background ,zenburn-bg+05 :overline ,zenburn-bg))))))
(load-theme 'zenburn t))
—have been yanked or pasted somehow such that I get this:
#+BEGIN_SRC emacs-lisp :tangle yes
;; set up 'package
(requir(use-package zenburn-theme
:ensure t
:config
;; customize zenburn faces (http://emacs.stackexchange.com/a/17962)
(zenburn-with-color-variables
(custom-theme-set-faces
'zenburn
;; change some org-mode faces to make org-blocks more legible à la leuven-theme
;; (https://github.com/bbatsov/zenburn-emacs/pull/175/commits/0c27021b8708464236b78a40546971279d5ae404)
`(org-block ((t (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
`(org-block-background ((t (:background ,zenburn-bg+1))))
`(org-block-begin-line ((t (:foreground ,zenburn-fg :background ,zenburn-bg+05 :underline ,zenburn-bg))))
`(org-block-end-line ((t (:foreground ,zenburn-fg :background ,zenburn-bg+05 :overline ,zenburn-bg))))))
(load-theme 'zenburn t))e 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
;; bootstrap 'use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; load 'use-package dependencies: 'bind-key and 'diminish
(require 'bind-key) ; (bundled with `use-package')
(use-package diminish
:ensure t)
#+END_SRC
In other words, unless I am mistaken, the text saved with org-edit-special
from an earlier session has survived into a new Emacs session and yanked itself into my buffer without my doing anything. It's annoying because, unless I am vigilant, my init will be broken next time I launch Emacs. Does this have something to do with org-mode or is a kill-ring problem? or does it have something to do with how the file is saving? (I have (add-hook 'before-save-hook 'time-stamp)
in my init in order to automatically update the date in the Time-stamp: <>
format.)