parent
965d59c3d8
commit
dd0af41191
|
@ -125,14 +125,11 @@
|
||||||
;; I find the default tex-mode and AucTeX quiet disappointing. I'm using custom
|
;; I find the default tex-mode and AucTeX quiet disappointing. I'm using custom
|
||||||
;; functions for everything.
|
;; functions for everything.
|
||||||
|
|
||||||
;; To use GnuPlot we need to allow external application to be called from TeX.
|
|
||||||
;; WARNING: the "--shell-escape" option is a potential security issue.
|
|
||||||
|
|
||||||
(defvar tex-my-compiler "pdftex"
|
(defvar tex-my-compiler "pdftex"
|
||||||
"This is the name of the executable called upon TeX compilations.
|
"This is the name of the executable called upon TeX compilations.
|
||||||
Examples: pdftex, pdflatex, xetex, xelatex, luatex, lualatex...")
|
Examples: pdftex, pdflatex, xetex, xelatex, luatex, lualatex...")
|
||||||
|
|
||||||
(defvar tex-my-compiler-options "-file-line-error-style -halt-on-error"
|
(defvar tex-my-compiler-options "-file-line-error-style -halt-on-error"
|
||||||
"The options to the tex compiler. Options are set between the
|
"The options to the tex compiler. Options are set between the
|
||||||
compiler name and the file name.
|
compiler name and the file name.
|
||||||
|
|
||||||
|
@ -141,13 +138,14 @@ Interresting options:
|
||||||
* -file-line-error-style: change the style of error report to
|
* -file-line-error-style: change the style of error report to
|
||||||
display file name and line first.
|
display file name and line first.
|
||||||
|
|
||||||
* -halt-on-error will disable interactive mode.
|
* -halt-on-error: will disable interactive mode.
|
||||||
|
|
||||||
* -interaction <mode>: like -halt-on-error, you can set the way
|
* -interaction <mode>: like -halt-on-error, you can set the way
|
||||||
the compilers behave on errors. Possible values for <mode> are
|
the compilers behave on errors. Possible values for <mode> are
|
||||||
'batchmode', 'errorstopmode', 'nonstopmode' and 'scrollmode'.
|
'batchmode', 'errorstopmode', 'nonstopmode' and 'scrollmode'.
|
||||||
|
|
||||||
* -shell
|
* -shell-escape: allow the use of \write18{<external command>}
|
||||||
|
from within TeX documents. This is a potential security issue.
|
||||||
|
|
||||||
You may use file local variable for convenience:
|
You may use file local variable for convenience:
|
||||||
|
|
||||||
|
@ -156,7 +154,7 @@ You may use file local variable for convenience:
|
||||||
Note that -shell-escape can also be toggled with universal
|
Note that -shell-escape can also be toggled with universal
|
||||||
argument.")
|
argument.")
|
||||||
|
|
||||||
(defvar tex-my-startcommands ""
|
(defvar tex-my-startcommands ""
|
||||||
"You can call a TeX compiler upon a string instead of a file.
|
"You can call a TeX compiler upon a string instead of a file.
|
||||||
This is actually useful if you want to customize your
|
This is actually useful if you want to customize your
|
||||||
compilation.
|
compilation.
|
||||||
|
@ -181,7 +179,16 @@ variable, e.g. on the first line:
|
||||||
")
|
")
|
||||||
|
|
||||||
(defun tex-my-compile ()
|
(defun tex-my-compile ()
|
||||||
"Use compile to process your TeX-based document."
|
"Use compile to process your TeX-based document. Use a prefix
|
||||||
|
argument to call the compiler along the '-shell-escape'
|
||||||
|
option. This will enable the use of '\write18{<external
|
||||||
|
command>}' from within TeX documents, which need to
|
||||||
|
allow external application to be called from TeX.
|
||||||
|
|
||||||
|
This may be useful for some features like GnuPlot support with TikZ.
|
||||||
|
|
||||||
|
WARNING: the -shell-escape option is a potential security issue."
|
||||||
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(cond
|
(cond
|
||||||
((string= "latex-mode" major-mode) (setq tex-my-compiler "pdflatex"))
|
((string= "latex-mode" major-mode) (setq tex-my-compiler "pdflatex"))
|
||||||
|
|
|
@ -48,27 +48,6 @@ alias grep='grep --color=auto'
|
||||||
## Bad idea because you cannot toggle '-f' option anymore.
|
## Bad idea because you cannot toggle '-f' option anymore.
|
||||||
# alias cp="cp -i"
|
# alias cp="cp -i"
|
||||||
|
|
||||||
## Emacs
|
|
||||||
## For the systemd unit, write the following file:
|
|
||||||
## /etc/systemd/system/emacs@.service
|
|
||||||
# [Unit]
|
|
||||||
# Description=Emacs: the extensible, self-documenting text editor
|
|
||||||
#
|
|
||||||
# [Service]
|
|
||||||
# Type=forking
|
|
||||||
# ExecStart=/usr/bin/emacs --daemon
|
|
||||||
# ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
|
|
||||||
# Restart=always
|
|
||||||
# User=%i
|
|
||||||
#
|
|
||||||
# [Install]
|
|
||||||
# WantedBy=multi-user.target
|
|
||||||
if [ -n "$(command -v emacs)" ]; then
|
|
||||||
alias em='emacsclient -a "" -t'
|
|
||||||
alias emacs-reload="emacsclient -e '(kill-emacs)' >/dev/null 2>&1; emacs --daemon"
|
|
||||||
# alias emacs-reload="sudo systemctl restart emacs@$USER"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# List desktop applications.
|
# List desktop applications.
|
||||||
[ -d /usr/share/applications ] && XDG_APPS=($XDG_APPS /usr/share/applications)
|
[ -d /usr/share/applications ] && XDG_APPS=($XDG_APPS /usr/share/applications)
|
||||||
[ -d /usr/local/share/applications ] && XDG_APPS=($XDG_APPS /usr/local/share/applications)
|
[ -d /usr/local/share/applications ] && XDG_APPS=($XDG_APPS /usr/local/share/applications)
|
||||||
|
@ -113,6 +92,29 @@ alias xmorphsw='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ")
|
||||||
alias xmorphzo='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --scale 1.2x1.2'
|
alias xmorphzo='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --scale 1.2x1.2'
|
||||||
alias xmorphzi='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --scale 0.8x0.8'
|
alias xmorphzi='xrandr --output $(xrandr | grep "\<connected\>" | cut -f1 -d" ") --scale 0.8x0.8'
|
||||||
|
|
||||||
|
##==============================================================================
|
||||||
|
## Emacs
|
||||||
|
##==============================================================================
|
||||||
|
## For the systemd unit, write the following file:
|
||||||
|
## /etc/systemd/system/emacs@.service
|
||||||
|
# [Unit]
|
||||||
|
# Description=Emacs: the extensible, self-documenting text editor
|
||||||
|
#
|
||||||
|
# [Service]
|
||||||
|
# Type=forking
|
||||||
|
# ExecStart=/usr/bin/emacs --daemon
|
||||||
|
# ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
|
||||||
|
# Restart=always
|
||||||
|
# User=%i
|
||||||
|
#
|
||||||
|
# [Install]
|
||||||
|
# WantedBy=multi-user.target
|
||||||
|
if [ -n "$(command -v emacs)" ]; then
|
||||||
|
alias em='emacsclient -a "" -t'
|
||||||
|
alias emacs-reload="emacsclient -e '(kill-emacs)' >/dev/null 2>&1; emacs --daemon"
|
||||||
|
# alias emacs-reload="sudo systemctl restart emacs@$USER"
|
||||||
|
fi
|
||||||
|
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
## Zsh power aliases
|
## Zsh power aliases
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
|
|
119
.shell.d/funs_rc
119
.shell.d/funs_rc
|
@ -755,6 +755,71 @@ lsofstat()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Executable info
|
||||||
|
xinf()
|
||||||
|
{
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Give an executable in PATH as parameter."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local xpath="$(type $1 | cut -d' ' -f3)"
|
||||||
|
ls -l "$xpath"
|
||||||
|
file "$xpath" | cut -d':' -f2 | cut -b 2-
|
||||||
|
}
|
||||||
|
|
||||||
|
## This function will try to find an input binary file in the content of binary
|
||||||
|
## files in current folder.
|
||||||
|
bindatasearch()
|
||||||
|
{
|
||||||
|
if [ $# -eq 0 ] || [ ! -f "$1" ]; then
|
||||||
|
echo "Please provide a valid single file as argument."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Must be a folder.
|
||||||
|
local TARGET=$PWD
|
||||||
|
if [ $# -eq 2 ] && [ -d "$2" ]; then
|
||||||
|
target="$2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## The awk command suppresses first column, spaces and line breaks.
|
||||||
|
local SOURCE=$(od -tx8 "$1" | awk '($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }')
|
||||||
|
|
||||||
|
## This special, not well-known syntax allows us to execute a set of
|
||||||
|
## functions upon the result of find. Since everything MUST be between
|
||||||
|
## simple quotes, we cannot use external variables directly. So we pass the
|
||||||
|
## $SOURCE variable as argument. The underscore at the end allows the use of
|
||||||
|
## arguments.
|
||||||
|
find "$WORKDIR" -type f -exec bash -c '
|
||||||
|
FILEDUMP=$(od -tx8 "$1" | awk '"'"'($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }'"'"')
|
||||||
|
grep -q "$2" <(echo $FILEDUMP)
|
||||||
|
|
||||||
|
[ $? -eq 0 ] && echo "$1"
|
||||||
|
' _ {} "$SOURCE" \;
|
||||||
|
}
|
||||||
|
|
||||||
|
## Xrandr
|
||||||
|
xmulti ()
|
||||||
|
{
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Wrong number of argument."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
xrandr --output "$1" --auto --right-of $(xrandr | sed -n "/current/{n;p;q}" | cut -f1 -d" ")
|
||||||
|
}
|
||||||
|
|
||||||
|
xmultioff ()
|
||||||
|
{
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Wrong number of argument."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
xrandr --output "$1" --off
|
||||||
|
}
|
||||||
|
|
||||||
## Format C using 'indent'. Alternative to indent: astyle, uncrustify.
|
## Format C using 'indent'. Alternative to indent: astyle, uncrustify.
|
||||||
formatc()
|
formatc()
|
||||||
{
|
{
|
||||||
|
@ -837,63 +902,11 @@ formatc()
|
||||||
# sed -i 's:\(//.*[^\.]\)$:\1\.:g' "$FILE"
|
# sed -i 's:\(//.*[^\.]\)$:\1\.:g' "$FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
## This function will try to find an input binary file in the content of binary
|
|
||||||
## files in current folder.
|
|
||||||
bindatasearch()
|
|
||||||
{
|
|
||||||
if [ $# -eq 0 ] || [ ! -f "$1" ]; then
|
|
||||||
echo "Please provide a valid single file as argument."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Must be a folder.
|
|
||||||
local TARGET=$PWD
|
|
||||||
if [ $# -eq 2 ] && [ -d "$2" ]; then
|
|
||||||
TARGET="$2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## The awk command suppresses first column, spaces and line breaks.
|
|
||||||
local SOURCE=$(od -tx8 "$1" | awk '($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }')
|
|
||||||
|
|
||||||
## This special, not well-known syntax allows us to execute a set of
|
|
||||||
## functions upon the result of find. Since everything MUST be between
|
|
||||||
## simple quotes, we cannot use external variables directly. So we pass the
|
|
||||||
## $SOURCE variable as argument. The underscore at the end allows the use of
|
|
||||||
## arguments.
|
|
||||||
find "$WORKDIR" -type f -exec bash -c '
|
|
||||||
FILEDUMP=$(od -tx8 "$1" | awk '"'"'($1="")1 gsub ( /\s/,"") { printf ("%s", $0) }'"'"')
|
|
||||||
grep -q "$2" <(echo $FILEDUMP)
|
|
||||||
|
|
||||||
[ $? -eq 0 ] && echo "$1"
|
|
||||||
' _ {} "$SOURCE" \;
|
|
||||||
}
|
|
||||||
|
|
||||||
## Xrandr
|
|
||||||
xmulti ()
|
|
||||||
{
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "Wrong number of argument."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
xrandr --output "$1" --auto --right-of $(xrandr | sed -n "/current/{n;p;q}" | cut -f1 -d" ")
|
|
||||||
}
|
|
||||||
|
|
||||||
xmultioff ()
|
|
||||||
{
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "Wrong number of argument."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
xrandr --output "$1" --off
|
|
||||||
}
|
|
||||||
|
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
## Pacman Functions
|
## Pacman Functions
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
|
|
||||||
[ -n "$(command -v pacman)" ] && . "${SHELL_DIR}/funs_pacman"
|
[ -n "$(command -v pacman)" ] && . "${SHELL_DIR}/funs_pacman"
|
||||||
|
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
## FreeBSD Functions
|
## FreeBSD Functions
|
||||||
|
|
Loading…
Reference in New Issue