init-defuns.org 5.3 KB

lexical binding

:PROPERTIES: :ID: c901c3d8-a46e-4b21-9105-482ab7b8ef16 :END:


;; -*- lexical-binding: t; -*-

defuns

COMMENT bbdb interfers with helm-mode

:PROPERTIES: :ID: b1333b3c-9345-4d66-9454-2f18db07f4e9 :END:

open some various files

#+BEGIN_SRC emacs-lisp (defun my/bbdb-create ()) #+END_SRC



(defun my/gtd ()
  "This command opens ~/things_to_do.org"
  (interactive)
  (find-file "~/prog/org/gtd.org"))

(defun my/init.el ()
  "init-file opens ~/.emacs"
  (interactive)
  (find-file "~/.config/emacs/init.el"))

(defun my/init-evil ()
  "loads my viper initialization file"
  (interactive)
  (load "~/.config/emacs/lisp/init-evil.el")
  (find-file "~/.config/emacs/lisp/init-evil.el"))

(defun rc.lua ()
  "This command opens ~/.config/awesome/rc.lua"
  (interactive)
  (find-file "~/.config/awesome/rc.lua"))

(defun emacs.texi ()
  "This command opens ~/manuals/cheatsheats/emacs.texi"
  (interactive)
  (find-file "~/manuals/cheatsheats/emacs.texi"))

(defun gawk.texi ()
  "This command opens ~/manuals/cheatsheats/gawk.texi"
  (interactive)
  (find-file "~/manuals/cheatsheats/gawk.texi"))

(defun systemd.texi ()
  "This command opens ~/manuals/systemd.texi"
  (interactive)
  (find-file "~/manuals/systemd.texi"))

testing awesome


(defun test-awesome ()
  "this run /home/joshua/programming/bash/test-awesome.bash"
  (interactive)
  (start-process "testing-awesome" "test-of-awesome" "test-awesome.bash"))

sudo find file


(defun sudo-find-file ()
  "Like find file, but opens the file as root."
  (interactive)
  (interactive "FSudo Find File: ")
  (let ((tramp-file-name (concat "/sudo::" (expand-file-name file-name))))
    (find-file tramp-file-name)))

(defun find-file-sudo (file-name)
  "Like find file, but opens the file as root."
  (interactive)
  (sudo-file-file))

Hurd view file in browser


  (defun view-hurd-file-in-browser ()
    "View this file in the browser"
    (interactive)
    (let [file (buffer-file-name)]))


COMMENT


(defun save-this-buffer-to-portfolio-site ()
  "Write this buffer to to my portfolio site"
  (interactive)
  ;; Take the current file and save it on the live server
  (setq current-directory
        (s-chop-prefix "Directory " (pwd)))
  (write-file "/ssh:jbranso_portfolio91@ssh.phx.nearlyfreespeech.net:/home/public/")
  ;;Take the current file and save it locally, that way, after I'm done saying the local file
  ;; to the server, pwd is still ~/programming/soihub
  (write-file current-directory))

(defun purdue-delete-this-buffer-from-dev-server ()
  "Remove this file to the purdue dev server."
  (interactive)
  (require 's)
  (let (remote-file-path remote-dir local-file)
    (setq local-file buffer-file-name)
    (setq remote-dir "/ssh:jbranso@dev.www.purdue.edu:/var/www/html/root/honorscollege/")
    (setq remote-file-path (concat
                            remote-dir
                            (s-chop-prefix "/home/joshua/honorscollege/" buffer-file-name)))
    (delete-file remote-file-path)))

(defun purdue-deploy-to-dev-server ()
  "Rsynce my project to purdue's dev server."
  (interactive)
  (let (remote-file  remote-file-prefix)
    (setq remote-file-prefix "/ssh:jbranso@dev.www.purdue.edu:/home/users/jbranso/HTML/honorscollege/")
    (setq (concat remote-file (s-chop-prefix "/srv/http/honorscollege/" buffer-file-name)))
    (print remote-file)
    ;; (write-file remote-file)
    ;;(write-file local-file)
    )
  ;; (start-process "rsync-purdue" "*Purdue Deploy*" "rsync"
  ;;                ;; be verbose
  ;;                "-v "
  ;;                ;; recursive into directories
  ;;                "-r "
  ;;                "/srv/http/honorscollege/"
  ;;                "jbranso@dev.www.purdue.edu:/var/www/html/root/honorscollege/")
  ;; (let ((password (read-string "Enter your password: ")))
  ;;   (process-send-string "rsync-purdue" password))
  ;; (split-window-below)
  ;; (windmove-down)
  ;; (switch-to-buffer "rsync-purdue")
  )

(defun org-babel-strip-php-from-sql-block ()
  "Cleans up a sql statement from
   $sql  = 'SELECT * ';
   $sql .= 'FROM USERS ';
   $sql .= 'WHERE 1';
   into
   SELECT *
   FROM USERS
   WHERE 1 "
  (interactive)
  ;; let's first move to the top of the buffer
  (beginning-of-buffer)
  ;; now move point forward to the first char in the buffer
  (while (re-search-forward "\";" nil t)
    (replace-match ""))
  (while (re-search-forward "\$sql.*=.*?" nil t)
    (replace-match ""))
  (while (re-search-forward "\$sql.*\.=.*?" nil t)
    (replace-match ""))
  (while (re-search-forward "\$sql.*=.*\"" nil t)
    (replace-match "")))

provide this file

#+BEGIN_SRC emacs-lisp (provide 'init-defuns) #+END_SRC