Browse Source

Improvements to SFDX; Created 'Convert to Table' org functions; Added

RG; Updated README
master
Levi Olson 4 years ago
parent
commit
239ce0c3cc
10 changed files with 246 additions and 23 deletions
  1. +1
    -0
      .gitignore
  2. +16
    -8
      README.org
  3. +1
    -0
      lisp/01-custom-early-init.el
  4. +13
    -0
      lisp/02-custom-package-setup.el
  5. +2
    -2
      lisp/03-custom-binds.el
  6. +69
    -1
      lisp/05-custom-functions.el
  7. +1
    -0
      lisp/07_5-custom-created-packages.el
  8. +73
    -7
      lisp/08-custom-packages.el
  9. +67
    -0
      lisp/custom/convert-to-table.el
  10. +3
    -5
      lisp/custom/sfdx.el

+ 1
- 0
.gitignore View File

@ -10,3 +10,4 @@
!lisp/*
lisp/*.el~
lisp/unused.el
.DS_Store

+ 16
- 8
README.org View File

@ -4,7 +4,7 @@
#+OPTIONS: ^:{} toc:nil num:nil tex:t
* Notes
My personal init.el focused on quick startup with minimal, but functional config.
My personal init.el focused on quick startup with (somewhat) minimal, but functional config.
Currently configured with these packages (list generated automatically):
#+begin_src emacs-lisp :results table :exports results
@ -21,6 +21,7 @@ Currently configured with these packages (list generated automatically):
#+RESULTS:
| ace-jump-mode | a quick cursor location minor mode for emacs |
| ag | A front-end for ag ('the silver searcher'), the C ack replacement. |
| amx | Alternative M-x with extra features. |
| angular-mode | Major mode for Angular.js |
| angular-snippets | Yasnippets for AngularJS |
@ -31,18 +32,20 @@ Currently configured with these packages (list generated automatically):
| company | Modular text completion framework |
| counsel | Various completion functions using Ivy |
| dashboard | A startup screen extracted from Spacemacs |
| deft | quickly browse, filter, and edit plain text notes |
| delight | A dimmer switch for your lighter text |
| diminish | Diminished modes are minor modes with no modeline display |
| dmenu | simulate the dmenu command line program |
| elfeed | an Emacs Atom/RSS feed reader |
| emojify | Display emojis in Emacs |
| engine-mode | Define and query search engines from within Emacs. |
| excorporate | Exchange Web Services (EWS) integration |
| expand-region | Increase selected region by semantic units. |
| exwm | Emacs X Window Manager |
| exwm-edit | Edit mode for EXWM |
| f | Modern API for working with files and directories |
| fic-mode | Show FIXME/TODO/BUG(...) in special face only in comments and strings |
| flycheck | On-the-fly syntax checking |
| fsm | state machine library |
| gitconfig-mode | Major mode for editing .gitconfig files |
| gitignore-mode | Major mode for editing .gitignore files |
| howdoyou | A stackoverflow and its sisters' sites reader |
@ -52,16 +55,18 @@ Currently configured with these packages (list generated automatically):
| json-reformat | Reformatting tool for JSON |
| json-snatcher | Grabs the path to JSON values in a JSON file |
| know-your-http-well | Look up the meaning of HTTP headers, methods, relations, status codes |
| linum-relative | display relative line number in emacs. |
| magit | A Git porcelain inside Emacs. |
| git-commit | Edit Git commit messages |
| markdown-mode | Major mode for Markdown-formatted text |
| multiple-cursors | Multiple cursors for Emacs. |
| nadvice | Forward compatibility for Emacs-24.4's nadvice |
| ob-async | Asynchronous org-babel src block execution |
| dash | A modern list library for Emacs |
| ob-restclient | org-babel functions for restclient-mode |
| org-bullets | Show bullets in org-mode as UTF-8 characters |
| org-link-minor-mode | Enable org-mode links in non-org modes |
| org | Outline-based notes management and organizer |
| org-plus-contrib | Outline-based notes management and organizer |
| ox-reveal | reveal.js Presentation Back-End for Org Export Engine |
| org | Outline-based notes management and organizer |
| ox-twbs | Bootstrap compatible HTML Back-End for Org |
| page-break-lines | Display ^L page breaks as tidy horizontal lines |
| projectile | Manage and navigate projects in Emacs easily |
@ -72,22 +77,25 @@ Currently configured with these packages (list generated automatically):
| rainbow-mode | Colorize color names in buffers |
| request | Compatible layer for URL request in Emacs |
| restclient | An interactive HTTP client for Emacs |
| rg | A search tool based on ripgrep. |
| ripgrep | Front-end for ripgrep, a command line search tool |
| rust-mode | A major emacs mode for editing Rust source code |
| s | The long lost Emacs string manipulation library. |
| scss-mode | Major mode for editing SCSS files |
| smex | M-x interface with Ido-style fuzzy matching. |
| soap-client | Access SOAP web services |
| sudo-edit | Open files as another user |
| swiper | Isearch with an overview. Oh, man! |
| ivy | Incremental Vertical completYon |
| transient | Transient commands |
| dash | A modern list library for Emacs |
| url-http-ntlm | NTLM authentication for the url library |
| use-package | A configuration macro for simplifying your .emacs |
| bind-key | A simple way to manage personal keybindings |
| web-mode | major mode for editing web templates |
| wgrep | Writable grep buffer and apply the changes to files |
| which-key | Display available keybindings in popup |
| with-editor | Use the Emacsclient as $EDITOR |
| async | Asynchronous processing in Emacs |
| xelb | X protocol Emacs Lisp Binding |
| yaml-mode | Major mode for editing YAML files |
| yasnippet | Yet another snippet extension for Emacs |
| zerodark-theme | A dark, medium contrast theme for Emacs |
| all-the-icons | A library for inserting Developer icons |

+ 1
- 0
lisp/01-custom-early-init.el View File

@ -16,6 +16,7 @@ Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)")
auto-window-vscroll nil)
(setq safe-local-variable-values (quote (
(visual-line-mode . 1)
(eval org-content 2)
(eval org-content 3)
(whitespace-line-column . 120)

+ 13
- 0
lisp/02-custom-package-setup.el View File

@ -56,5 +56,18 @@
:prefix "C-c h")
)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(provide '02-custom-package-setup)
;;; 02-custom-package-setup.el ends here

+ 2
- 2
lisp/03-custom-binds.el View File

@ -19,8 +19,8 @@
exec-path)))
(bind-key "<M-return>" 'eshell)
(bind-key "<M-S-return>" 'ansi-term)
(bind-key "C-c r" '(lambda () (interactive) (load-file user-init-file)))
(bind-key "<C-M-return>" 'ansi-term)
(bind-key "C-c R" '(lambda () (interactive) (load-file user-init-file)))
(provide '03-custom-binds)
;;; 03-custom-binds.el ends here

+ 69
- 1
lisp/05-custom-functions.el View File

@ -96,9 +96,77 @@
(leo/last-car (split-string url "/" t))
"\\." nil)
)
))
))
(message mode))
)
(defun leo/org-global-props (&optional property buffer)
"Get the plists of global org PROPERTY of current BUFFER."
(unless property (setq property "PROPERTY"))
(with-current-buffer (or buffer (current-buffer))
(org-element-map (org-element-parse-buffer) 'keyword (lambda (el) (when (string-match property (org-element-property :key el)) el)))))
(defun leo/org-global-prop-value (key)
"Get global org property KEY (case sensitive) of current buffer."
(org-element-property :value (car (leo/org-global-props key))))
(defun leo/deft-insert-boilerplate ()
"Insert boilerplate into newly create roam note."
(interactive)
(let ((title (leo/org-global-prop-value "TITLE"))
(startup (leo/org-global-prop-value "STARTUP")))
(when (not startup)
(kill-region (point-min) (point-max))
(goto-char (point-min))
(insert (format "#+TITLE: %s\n" title))
(insert "#+STARTUP: showall\n")
(insert "\n")
(insert "* Metadata:\n")
(insert "** Tags: ")
(goto-char (point-max)))))
(defun leo/org-narrow-prev-tree ()
"When in a narrowed region, this will take you to the previous heading and narrow."
(interactive)
(goto-char (point-min))
(widen)
(org-backward-element)
(org-narrow-to-subtree))
(defun leo/org-narrow-next-tree ()
"When in a narrowed region, this will take you to the next heading and narrow."
(interactive)
(goto-char (point-min))
(widen)
(org-forward-element)
(org-narrow-to-subtree))
(defun leo/org-present ()
"Begin an `org-mode' presentation."
(interactive)
(defvar old-mlf nil "Temp storage of mode-line-format while in 'present mode'.")
(if (buffer-narrowed-p)
(progn
(widen)
(setq mode-line-format old-mlf)
(setq cursor-type 'box)
(read-only-mode -1)
(text-scale-adjust 0)
(visual-line-mode nil)
(toggle-word-wrap nil)
(message "No longer presenting")
)
(setq old-mlf mode-line-format)
(setq mode-line-format nil)
(org-narrow-to-subtree)
(setq cursor-type nil)
(read-only-mode 1)
(text-scale-adjust 6)
(visual-line-mode 1)
(toggle-word-wrap 1)
(message "Presenting")
))
(provide '05-custom-functions)
;;; 05-custom-functions.el ends here

+ 1
- 0
lisp/07_5-custom-created-packages.el View File

@ -5,6 +5,7 @@
;;; Code:
(require 'sfdx)
(require 'convert-to-table)
(provide '07_5-custom-created-packages)
;;; 07_5-custom-created-packages.el ends here

+ 73
- 7
lisp/08-custom-packages.el View File

@ -33,6 +33,9 @@
;;; Code:
(use-package ag
:ensure t)
;; https://melpa.org/#/async
(use-package async
:ensure t)
@ -112,7 +115,9 @@
;; M-x all-the-icons-install-fonts
(use-package all-the-icons
:ensure t)
:ensure t
:config
(setq inhibit-compacting-font-caches t))
;; https://github.com/emacs-dashboard/emacs-dashboard
(use-package dashboard
@ -295,12 +300,23 @@
("C-x g" . magit-status)
("C-c g" . magit-status))
;; This is used in `rg-menu'
(use-package rg
:ensure t)
;; This is used in `projectile'
(use-package ripgrep
:ensure t)
;; https://github.com/bbatsov/projectile
(use-package projectile
:delight '(:eval (concat " [" (projectile-project-name) "]"))
:ensure t
:bind-keymap
("C-c p" . projectile-command-map)
:bind (
("C-c p" . projectile-command-map)
:map projectile-command-map
("s r" . rg-project)
)
:init
;; (setq projectile-mode-line-prefix " P")
(setq projectile-completion-system 'ivy)
@ -372,6 +388,9 @@
("C-x C-l a" . org-agenda)
:map org-mode-map
("M-RET" . org-insert-todo-heading)
("M-n" . leo/org-narrow-next-tree)
("M-p" . leo/org-narrow-prev-tree)
("M-P" . leo/org-present)
)
:preface
(defvar org-html-validation-link)
@ -381,6 +400,7 @@
"~/Dropbox/Org/projects.org"
"~/Dropbox/Org/archive.org"
"~/Dropbox/Org/diary/eaglecrk.org"))
(add-to-list 'safe-local-variable-values '(eval leo/deft-insert-boilerplate))
(setq org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)")
(sequence "BUG(b)" "INPROGRESS(i)" "|" "FIXED(f)")
(sequence "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)")
@ -468,12 +488,13 @@
;; https://github.com/astahlman/ob-async
(use-package ob-async
:ensure t
:after (org))
:after org)
;; https://github.com/sabof/org-bullets
(use-package org-bullets
:ensure t
:after (org)
:after org
:commands org-bullets-mode
:hook (org-mode . org-bullets-mode)
:config
(set-face-attribute 'org-level-1 nil :height 1.3)
@ -487,7 +508,7 @@
;; https://orgmode.org/worg/org-contrib/org-protocol.html
(use-package org-protocol
:ensure org-plus-contrib
:after (org)
:after org
:preface
(defvar org-capture-templates)
:init
@ -507,7 +528,52 @@
(use-package ox-twbs
:ensure t
:demand t
:after (org))
:after org)
(use-package ox-extra
:ensure org-plus-contrib
:after org
:config
(ox-extras-activate '(ignore-headlines)))
;; https://github.com/yjwen/org-reveal
(use-package ox-reveal
:ensure t
:after org)
;; https://github.com/jethrokuan/org-roam/
(use-package org-roam
:ensure t
:after org
:hook
((org-mode . org-roam-mode)
(after-init . org-roam--build-cache-async) ;; optional!
)
:straight (:host github :repo "jethrokuan/org-roam" :branch "develop")
:custom
(org-roam-directory "~/Dropbox/Org/Roam/")
:config
(org-roam--build-cache-async)
(setq org-roam-graphviz-executable "/usr/local/Cellar/graphviz/2.42.2/bin/dot")
(setq org-roam-graph-viewer "/usr/bin/open")
(setq org-roam-link-title-format "r::%s")
:bind
("C-c n l" . org-roam)
("C-c n t" . org-roam-today)
("C-c n f" . org-roam-find-file)
("C-c n i" . org-roam-insert)
("C-c n g" . org-roam-show-graph))
;; https://github.com/jrblevin/deft
(use-package deft
:after org
:bind
("C-c n d" . deft)
:custom
(deft-recursive t)
(deft-use-filter-string-for-filename t)
(deft-default-extension "org")
(deft-directory "~/Dropbox/Org/Roam/"))
;; https://github.com/hniksic/emacs-htmlize
(use-package htmlize

+ 67
- 0
lisp/custom/convert-to-table.el View File

@ -0,0 +1,67 @@
;;; convert-to-table --- Convert a selected region to an `org-mode' table.
;;; Commentary:
;;; Code:
(defun leo/remove-excess-line-breaks (input)
"Remove excess line breaks from INPUT."
(let ((mylist (split-string input "\n")))
(setq mylist (remove-duplicates mylist :test 'string=))
(delete "" mylist)
(string-join mylist "\n")
))
(defun set-nth (list n val)
"Update LIST at position N with value VAL."
(if (> n 0)
(cons (car list)
(set-nth (cdr list) (1- n) val))
(cons val (cdr list))))
(defun leo/build-divider (cols)
"Build an `org-mode' table divider with COLS columns."
(let ((index 0)
(output '()))
(while (> cols index)
(push "---" output)
(setq index (+ index 1)))
(concat "|" (string-join output "|") "|")))
(defun leo/convert-to-table (beg end)
"Convert <RET> delimited region (BEG and END) into `org-mode' table."
(interactive (if (use-region-p)
(list (region-beginning) (region-end))
(list nil nil)))
(let (
(input (leo/remove-excess-line-breaks (buffer-substring-no-properties beg end)))
(cols (read-number "How many columns: "))
)
(if (and input cols)
(let (
(lines (split-string input "\n"))
(length (length (split-string input "\n")))
(times 1)
(output "")
)
(setq output (mapcar (lambda (in) (concat " | " in)) lines))
;; (message "%s" output)
(while (>= length (* times cols))
(setq output (set-nth output (- (* times cols) 1) (concat (nth (- (* times cols) 1) output) " |\n")))
(setq times (+ times 1))
)
(kill-region beg end)
(let (
(rows (split-string (string-join output "") "\n"))
(first "")
)
(setq first (pop rows))
(push (leo/build-divider cols) rows)
(push first rows)
(insert (string-join rows "\n"))
))
(message "Nothing selected!"))))
(provide 'convert-to-table)
;;; convert-to-table.el ends here

+ 3
- 5
lisp/custom/sfdx.el View File

@ -48,13 +48,11 @@
"Create a new Lightning Web Component."
(interactive)
(if (locate-dominating-file buffer-file-name "force-app")
(let ((process "*sfdx-create-component-process*")
(buffer "*sfdx*")
(output-path (concat (locate-dominating-file buffer-file-name "force-app") "force-app/main/default/lwc"))
(let ((process "sfdx-create-component")
(output-path (concat (locate-dominating-file buffer-file-name "force-app") "force-app/main/default/lwc/"))
(comp-name (read-string "Component Name: "))
)
(call-process (concat "sfdx force:lightning:component:create --type lwc --componentname " comp-name " --outputdir " output-path) nil buffer)
(find-file (concat output-path "/" comp-name "/" comp-name ".js"))
(async-start-process process "sh" (lambda (result) (message "Component Created")) "-c" (concat "sfdx force:lightning:component:create --type lwc --componentname " comp-name " --outputdir " output-path))
)
(message "You must be in an SFDX project to run that command!")))

Loading…
Cancel
Save