(defun my-ecb-toggle-windows()
"Toggle visibility of ecb windows and switsch cursor"
(interactive)
(ecb-toggle-ecb-windows)
(ecb-goto-window-methods))
(defun my-ecb-prev-tree-item()
(interactive)
(forward-line -1)
(beginning-of-line)
(re-search-forward tree-buffer-incr-searchpattern-indent-prefix nil t))
(defun my-ecb-next-tree-item()
(interactive)
(forward-line +1)
(beginning-of-line)
(re-search-forward tree-buffer-incr-searchpattern-indent-prefix nil t))
(defun my-ecb-select-tree-item()
(interactive)
(tree-buffer-select 0 nil nil nil))
(defun my-ecb-quit-window()
(interactive)
(ecb-toggle-ecb-windows 0))
(defun tip-of-the-day ()
"Displays help output of a random symbol."
(interactive)
(random t) ;; seed with time-of-day
(with-output-to-temp-buffer "*Tip of the day*"
(let* ((commands (loop for s being the symbols
when (commandp s) collect s))
(command (nth (random (length commands)) commands)))
(princ
(concat "Your tip for the day is:\n"
"========================\n\n"
(describe-function command)
"\n\nInvoke with:\n\n"
(with-temp-buffer
(where-is command t)
(buffer-string)))))))
(defun count-words-in-buffer()
"Counts the number of words in the current buffer and displays\n\
the result in the minibuffer."
(interactive)
(save-excursion
(let ((count 0))
(goto-char (point-min))
(while (< (point) (point-max))
(forward-word 1)
(setq count (1+ count)))
(message "The current buffer contains %d words." count))))
(defun hungry-kill-line()
"Kill the rest of the current line and the whitespaces at the beginnng of
the next line."
(interactive)
(kill-line)
(delete-horizontal-space))
;; Appointments:
(defvar my-show-appt-running-process nil
"Points to the running my-show-appt process or nil.")
(defun my-show-appt (min-to-app new-time appt-msg)
"Show appointment in external program"
(setq my-show-appt-running-process
(start-process "my-show-appt" nil "/suse/home/rbreu/bin/show_message.py"
"-t" "Do you have a date?"
"--fgcolor" "white" "--bgcolor" "black"
"-i" "/suse/home/rbreu/bilder/harkness_small2.png"
"-b" (format "\n%s" appt-msg)
"-T" "Ecalendar" "-y" "0" "-x" "1130")))
(defun my-show-appt-kill ()
(signal-process (process-id my-show-appt-running-process) 'SIGINT))
;;Skeletons
(define-skeleton python-openfile-skeleton
"Inserts file open"
"File name: "
"try:" \n
"f = open('" str "')" \n
_ \n
"except OSError:" (indent-for-tab-command) \n
"print 'Sorry.'")
(define-skeleton html-precode-skeleton
"Inserts ...
"
nil
"\n"
_ \n
"
" (indent-for-tab-command) \n )
(define-skeleton latex-frame-skeleton
"Inserts \begin{frame}...\end{frame}"
"Title: "
"\\begin{frame}{" str "}" \n
_ \n
"\\end{frame}" (indent-for-tab-command) \n )
(define-skeleton latex-listing-skeleton
"Inserts \begin{lstlisting}...\end{lstlisting}"
"Style: "
"\\begin{lstlisting}[style=" str "]\n"
_ \n
"\\end{lstlisting}" (indent-for-tab-command) \n )
(define-skeleton latex-itemize-skeleton
"Inserts \begin{itemize}...\end{itemize}"
nil
"\\begin{itemize}" \n
"\\item " _ \n
"\\end{itemize}" (indent-for-tab-command) \n )
(provide 'rbutils)