Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codefmt] delete trailing whitespaces #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions org-wiki.el
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ You can toggle read-only mode with M-x read-only-mode or C-x C-q."
(defcustom org-wiki-clip-jar-path "~/bin/Clip.jar"
"Path to Clip.jar utility to paste images from clipboard."
:type 'file
:group 'org-wiki
:group 'org-wiki
)


Expand Down Expand Up @@ -179,16 +179,16 @@ You can toggle read-only mode with M-x read-only-mode or C-x C-q."

(defun org-wiki--get-buffers ()
"Return all org-wiki page buffers (.org) files in `org-wiki-location`."
(org-wiki--start-location)
(org-wiki--start-location)
(cl-remove-if-not (lambda (p)
(let* ((fp (buffer-file-name p))
(fpath (if fp (expand-file-name fp) nil))
)
;; path test if file exists (if fpath not nil)
(and fpath
;; test if buffer file is in wiki location
;; test if buffer file is in wiki location
(string-prefix-p (expand-file-name org-wiki-location) fpath)
;; test if buffer file has extension .org
;; test if buffer file has extension .org
(string-suffix-p ".org" fpath)
)))
(buffer-list)))
Expand Down Expand Up @@ -385,12 +385,12 @@ Will open the the wiki file Linux.org in

;; Action executed if file exists.
(if org-wiki-default-read-only
;; open file in read-only mode.
;; open file in read-only mode.
(progn (find-file org-wiki-file)
(read-only-mode 1))
;; open file in writable mode.
;; open file in writable mode.
(find-file org-wiki-file))
)))
)))


(defun org-wiki--assets-get-file (pagename filename)
Expand Down Expand Up @@ -837,7 +837,7 @@ to cancel the download."
(with-current-buffer b
(when (and (org-wiki--is-buffer-in b)
(equal major-mode 'image-mode))
(kill-this-buffer))))
(kill-this-buffer))))
(buffer-list))
(message "All wiki images closed. Ok."))

Expand Down Expand Up @@ -917,13 +917,13 @@ to cancel the download."
(defun org-wiki-export-with (org-exporter)
"Export all pages to a given format. See full doc.
ORG-EXPORTER is a function that exports an org-mode page to a specific format like html.
It can be for instance:
It can be for instance:

- org-html-publish-to-thml
- org-html-publish-to-thml
- org-latex-publish-to-pdf
- org-latex-publish-to-latex

WARN: This is a synchronous function and can freeze Emacs. Emacs will freeze while
WARN: This is a synchronous function and can freeze Emacs. Emacs will freeze while
the exporting doesn't finish. Type C-g to abort the execution."
(interactive)
(let ((org-html-htmlize-output-type 'css)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ Note: This function doesn't freeze Emacs since it starts another Emacs process."


;;
;; Despite this function was implemented as a interface to
;; Despite this function was implemented as a interface to
;; Python3 simple http server, it can be refactored to work
;; with another more powerful http server such as Nginx.
;;
Expand All @@ -1023,7 +1023,7 @@ Note: This function doesn't freeze Emacs since it starts another Emacs process."
Note: This command requires Python3 installed."
(interactive)
(let (
;; Process name
;; Process name
(pname "org-wiki-server")
;; Buffer name - Display process output (stdout)
(bname "*org-wiki-server*")
Expand All @@ -1034,7 +1034,7 @@ Note: This command requires Python3 installed."
(sit-for 0.1)
(switch-to-buffer bname)
(save-excursion ;; Save cursor position
(insert "Server started ...\n\n")
(insert "Server started ...\n\n")
(message "\nServer started ...\n")

;; Show machine network cards' IP addresses.
Expand All @@ -1046,23 +1046,23 @@ Note: This command requires Python3 installed."
;; Mac OSX - (Not tested )
(darwin (insert (shell-command-to-string "ifconfig")))
;; Windows 7, 8, 10 - Kernel NT
(windows-nt (insert (shell-command-to-string "ipconfig")))))
(windows-nt (insert (shell-command-to-string "ipconfig")))))
(start-process pname
bname
"python3"
"-m"
"http.server"
"--bind"
org-wiki-server-host
org-wiki-server-port)
org-wiki-server-port)
(when (y-or-n-p "Open server in browser ?")
(browse-url (format "http://localhost:%s" org-wiki-server-port))))
(browse-url (format "http://localhost:%s" org-wiki-server-port))))
(progn (switch-to-buffer bname)
(kill-process (get-process pname))
(message "Server stopped.")
))))

(defun org-wiki-paste-image ()
(defun org-wiki-paste-image ()
"Paste a image asking the user for the file name."
(interactive)
(let* ((dir (file-name-as-directory
Expand Down Expand Up @@ -1096,7 +1096,7 @@ Note: This command requires Python3 installed."
(interactive)
(let* ((dir (file-name-base
(buffer-file-name))))

(org-wiki--assets-make-dir dir)

(insert "#+CAPTION: ")
Expand Down Expand Up @@ -1125,7 +1125,7 @@ Note: This command requires Python3 installed."
;; The initial value - Set to 1 to enable by default
nil
;; The indicator for the mode line.
nil
nil
;; The minor mode keymap
`(
;; Commands to Open Index page:
Expand All @@ -1139,7 +1139,7 @@ Note: This command requires Python3 installed."
(,(kbd "hr") . org-wiki-helm-read-only)
(,(kbd "hf") . org-wiki-helm-frame)
(,(kbd "kk") . org-wiki-close)

;; ==== Commands to browse directories =====
(,(kbd "dw") . org-wiki-dired )
(,(kbd "do") . org-wiki-open)
Expand All @@ -1162,10 +1162,10 @@ Note: This command requires Python3 installed."

(,(kbd "ttb") . (lambda () (interactive) (tool-bar-mode 'toggle)))
(,(kbd "ttm") . (lambda () (interactive) (menu-bar-mode 'toggle)))

(,(kbd "q") . (lambda () (interactive) (kill-buffer)))
)
;; Make mode local to buffer rather than global
;; Make mode local to buffer rather than global
;; :global t
)

Expand All @@ -1192,14 +1192,14 @@ Note: This command requires Python3 installed."
(find-dired org-wiki-location
(mapconcat #'identity
'(
"-not -path '*/.git*'" ;; Exclude .git Directory
"-not -path '*/.git*'" ;; Exclude .git Directory
"-and -not -name '.#*'" ;; Exclude temporary files starting with #
"-and -not -name '#*'"
"-and -not -name '*#'"
"-and -not -name '*~' " ;; Exclude ending with ~ (tilde)
"-and -not -name '*.html' " ;; Exclude html files
"-and -not -name '*.html' " ;; Exclude html files
)

" "
)))

Expand Down Expand Up @@ -1427,7 +1427,7 @@ Toggle
;; ========= org-wiki Internal databases =========== ;;

;; Variable containing useful math, physics, currencies and greek letters used by function
;; org-wiki-insert-symbol
;; org-wiki-insert-symbol
(defvar org-wiki-symbol-list
'(
("alpha" . "α")
Expand All @@ -1436,7 +1436,7 @@ Toggle
("Gamma" ."Γ")
("delta" . "δ")
("Delta" . "Δ")
("episilon" ."ε")
("episilon" ."ε")
("zeta" ."ζ")
("eta" ."η")
("theta" ."θ")
Expand All @@ -1457,17 +1457,17 @@ Toggle
("Phi" ."Φ")
("psi" ."Ψ")
("omega" ."ω")
("Omega" ."Ω")
("Omega" ."Ω")

("Multiplication sign" . "×")
("Multiplication dot (sdot)" . "⋅")
("Division sign" . "÷")

;;; Mathematical Symbols for calculus
("Square root sqrt" . "√")
("Cubic root cbrt" . "∛")
("Fourth root" . "∜")
("Fourth root" . "∜")

("Infinity" . "∞")
("summation" . "Σ")
("product - big PI" . "Π")
Expand All @@ -1481,11 +1481,11 @@ Toggle
("tensor-prod" . "⊗")
("Direct sum or Exclusive or" . "⊕")
("Gradient, nabla" ."∇")

("Laplace transform" . "ℒ")
("Fourier transform" . "ℱ")
;; Symbols for set algebra

;; Symbols for set algebra
("Empty set" . "∅")
("Set membership" . "∈")
("Universal quantifier" . "∀")
Expand All @@ -1495,10 +1495,10 @@ Toggle
("Logic - Logical NOT" . "¬")
("Logic - Logical AND" . "∧")
("Logic - Logical OR" . "∨")
("Real numbers" . "ℝ")


("Real numbers" . "ℝ")

;; Misc Symbols
("Per mile" . "‰")
("Per basis points" . "‱")
Expand All @@ -1524,14 +1524,14 @@ Toggle
("Geometry - Spherical angle" . "∢")
("Geometry - Perpendicular to" . "⟂")
("Geometry - right angle" . "∟")

;; Health and safety
("WARN Skull and crossbones" . "☠")
("WARN Radioactive" . "☢")
("WARN Biohazard" . "☣")
("WARN Warning sign" . "⚠")
("WARN High voltage" . "⚡")

;; Fractions
("Fraction one-quarter" . "¼")
("Fraction one-half" . "½")
Expand All @@ -1548,10 +1548,10 @@ Toggle
("Currency Euro" . "€")
("Currency Yen, Yuan, Reminbi (China)" . "¥")
("Currency Won" . "₩")
("Currency Russian Ruble" . "₽")
("Currency Russian Ruble" . "₽")
("Currency Lira" . "₤")
("Currency Bitcoin" . "₿")
("Currency Indian Rupee" . "₹")
("Currency Indian Rupee" . "₹")
))

(defvar org-wiki-template-blocks
Expand All @@ -1570,18 +1570,18 @@ Toggle
("R code block" . "#+BEGIN_SRC R \n\n#+END_SRC")
("Elisp code block" . "#+BEGIN_SRC elisp \n\n#+END_SRC")
("C++ code block" . "#+BEGIN_SRC cpp \n\n#+END_SRC")
("Scala code block" . "#+BEGIN_SRC scala \n\n#+END_SRC")
("Scala code block" . "#+BEGIN_SRC scala \n\n#+END_SRC")
))

;; Latex templates used by user command M-x org-wiki-insert-latex
;; Latex templates used by user command M-x org-wiki-insert-latex
(defvar org-wiki-latex-templates
'(
("Latex equation block " . "\\begin{equation}\n\n\\end{equation}")
("Basic Fraction num/den - ½" . "\\frac{num}{den}")
("Basic Summation - Σ from a to b" . "\\sum_{a}^{b}")
("Basic Product - Π from a to b" . "\\prod_{a}^{b}")
("Basic Binomial coefficient (n k) = n! / ((n -k)! x k!) " . "{n \\choose k}")

("Calculus Limit lim(x -> ∞) f(x)" . "\\lim_{x \\to \\infty} f(x)")
("Calculus Integral - ∫ from a to b" . "\\int_{a}^{b}")
("Calculus Infinity - ∞" . "\\infty")
Expand All @@ -1590,7 +1590,7 @@ Toggle
("Calculus Second Derivate of f d^2f/dx^2" . "\\frac{d^2f}{dx^2}" )
("Calculus Derivate operation d/dx p(x)" . "\\frac{d}{dx} p(x)" )
("Calculus Second Derivate operation d^2/dx^2 p(x)" . "\\frac{d^2}{dx^2} p(x)" )
("Calculus Partial derivate - ∂" . "\\partial")
("Calculus Partial derivate - ∂" . "\\partial")
("Calculus Partial derivate fraction ∂x/∂t" . "\\frac{\\partial x}{\\partial y}")
("Calculus Second Partial derivate fraction ∂2x/∂t2" . "\\frac{\\partial^2 x}{\\partial y^2}")

Expand All @@ -1601,30 +1601,30 @@ Toggle
("Operator - times x" . "\\times")
("Operator - div %" . "\\div")
("Operator - Approximately ~=" . "\\prox")
("Operator - Proportional to ∝" . "\\propto")
("Operator - Proportional to ∝" . "\\propto")

("Escape - $" . "\\textdollar")
("Escape - Underline - _ " . "\\_")
("Escape - Ampersand - &" . "\\&")
("Escape - percent - %" . "\\%")
("Escape - tilde ~" . "\\sim")

("Func - limit" . "\\lim")
("Func - √ square root sqrt" . "\\sqrt{}")
("Func - n√ nth root" . "\\sqrt[n]{}")

("Enclosing () - Big parenthesis" . "\\left( <expr> \\right)")
("Enclosing \/ - Underbrace" . "\\underbrace{ <expr> }")
("Enclosing /\ - Overbrace" . "\\overbrace{ <expr> }")

("Accent - hat â, î" . "\\hat{}")
("Accent - grave à, ì" . "\\grave{}")
("Accent - bar - stroke over symbol" . "\\bar{}")
("Accent - tilde - ã, ĩ - tilde over symbol" . "\\tilde{}")
("Accent - dot (derivate) symbol" . "\\dot{}")
("Accent - double dot (double derivate) symbol" . "\\ddot{}")
("Accent - arrow over symbol, vector" . "\\vec{}")
("Accent - arrow over symbol, vector" . "\\vec{}")

;; Set notation
("Sets - N Set of Natural Numbers" . "\\N")
("Sets - Z Set of Integers" . "\\Z")
Expand All @@ -1642,7 +1642,7 @@ Toggle
("Greek α - lower alpha" . "\\alpha")
("Greek β - lower beta" . "\\beta")
("Greek σ - lower sigma" . "\\sigma")
("Greek Σ - upper sigma" . "\\Sigma")
("Greek Σ - upper sigma" . "\\Sigma")
("Greek γ - lower gamma" . "\\gamma")
("Greek Γ - upper gamma" . "\\Gamma")
("Greek δ - lower delta" . "\\delta")
Expand All @@ -1654,20 +1654,20 @@ Toggle
("Greek ζ - zeta" . "\\zeta")
("Greek η - eta" . "\\eta")
("Greek μ - mu" . "\\mu")
("Greek ρ - rho" . "\\rho")
("Greek ρ - rho" . "\\rho")
("Greek φ - lower phi" . "\\phi")
("Greek Φ - upper phi" . "\\Phi")
("Greek ω - lower omega" . "\\omega")
("Greek Φ - upper phi" . "\\Phi")
("Greek ω - lower omega" . "\\omega")
("Greek Ω - upper omega" . "\\Omega")
("Greek Ψ - psi" . "\\psi")
("Greek Ψ - psi" . "\\psi")
("Greek τ - tau" . "\\tau")
("Greek ι - lower iota" . "\\iota")
("Greek ξ - lower xi" . "\\xi")
("Greek Ξ - upper xi" . "\\xi")
("Greek Ξ - upper xi" . "\\xi")
("Symbol -> Right arrow" . "\\rightarrow")
("Symbol <- Left arrow" . "\\leftarrow")
("Symbol Up arrow" . "\\uparrow")
("Symbol Down arrow" . "\\downarrow")
("Symbol Down arrow" . "\\downarrow")
))


Expand Down