Skip to content

Instantly share code, notes, and snippets.

View pjones's full-sized avatar
🏠
Working from home

Peter J. Jones pjones

🏠
Working from home
View GitHub Profile
(defun pjones:org-goto (&optional alternative-interface)
"My version of `org-goto' that first widens the buffer (if
narrowed), jumps to the correct heading via `org-goto', then
narrows it again if necessary."
(interactive "P")
(let ((point-size (save-restriction (- (point-max) (point-min))))
(buff-size (buffer-size)))
(widen)
(org-goto alternative-interface)
(if (/= buff-size point-size) (org-narrow-to-subtree))))
@pjones
pjones / macenv.rb
Created February 22, 2012 20:36
Create an env file for Mac OS GUI applications
#!/usr/bin/env ruby
PASS_THROUGH = %w(PATH MANPATH EDITOR)
DIRECTORY = File.expand_path('~/.MacOSX')
FILENAME = File.join(DIRECTORY, 'environment.plist')
Dir.mkdir(DIRECTORY) unless File.exist?(DIRECTORY)
HEADER = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">