From 7a3b877abecb9b2f8ee1200bd2617202b325acd1 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Sat, 20 Feb 2021 21:03:18 +0100 Subject: Update markdown-mode and remove / cleanup some Python snippets --- .emacs.d/lisp/markdown-mode.el | 18 +++++++++++++----- .emacs.d/snippets/python-mode.statnett/classmethod | 10 ---------- .emacs.d/snippets/python-mode.statnett/cls | 8 -------- .emacs.d/snippets/python-mode.statnett/dec | 14 -------------- .emacs.d/snippets/python-mode.statnett/function | 8 -------- .emacs.d/snippets/python-mode.statnett/import | 7 ------- .emacs.d/snippets/python-mode.statnett/method | 7 ------- .emacs.d/snippets/python-mode.statnett/not_impl | 2 +- .emacs.d/snippets/python-mode.statnett/pass | 5 ----- .emacs.d/snippets/python-mode.statnett/property_getter | 3 +-- .emacs.d/snippets/python-mode.statnett/property_setter | 2 +- .emacs.d/snippets/python-mode.statnett/scls | 7 ------- .emacs.d/snippets/python-mode.statnett/script | 4 ++-- .emacs.d/snippets/python-mode.statnett/selfassign | 2 +- .emacs.d/snippets/python-mode.statnett/while | 7 ------- .emacs.d/snippets/python-mode.statnett/with | 7 ------- .emacs.d/snippets/python-mode/classmethod | 10 ---------- .emacs.d/snippets/python-mode/cls | 8 -------- .emacs.d/snippets/python-mode/dec | 14 -------------- .emacs.d/snippets/python-mode/function | 8 -------- .emacs.d/snippets/python-mode/import | 7 ------- .emacs.d/snippets/python-mode/method | 7 ------- .emacs.d/snippets/python-mode/not_impl | 2 +- .emacs.d/snippets/python-mode/pass | 5 ----- .emacs.d/snippets/python-mode/property_getter | 3 +-- .emacs.d/snippets/python-mode/property_setter | 2 +- .emacs.d/snippets/python-mode/scls | 7 ------- .emacs.d/snippets/python-mode/script | 1 - .emacs.d/snippets/python-mode/selfassign | 2 +- .emacs.d/snippets/python-mode/while | 7 ------- .emacs.d/snippets/python-mode/with | 7 ------- 31 files changed, 23 insertions(+), 178 deletions(-) delete mode 100644 .emacs.d/snippets/python-mode.statnett/classmethod delete mode 100644 .emacs.d/snippets/python-mode.statnett/cls delete mode 100644 .emacs.d/snippets/python-mode.statnett/dec delete mode 100644 .emacs.d/snippets/python-mode.statnett/function delete mode 100644 .emacs.d/snippets/python-mode.statnett/import delete mode 100644 .emacs.d/snippets/python-mode.statnett/method delete mode 100644 .emacs.d/snippets/python-mode.statnett/pass delete mode 100644 .emacs.d/snippets/python-mode.statnett/scls delete mode 100644 .emacs.d/snippets/python-mode.statnett/while delete mode 100644 .emacs.d/snippets/python-mode.statnett/with delete mode 100644 .emacs.d/snippets/python-mode/classmethod delete mode 100644 .emacs.d/snippets/python-mode/cls delete mode 100644 .emacs.d/snippets/python-mode/dec delete mode 100644 .emacs.d/snippets/python-mode/function delete mode 100644 .emacs.d/snippets/python-mode/import delete mode 100644 .emacs.d/snippets/python-mode/method delete mode 100644 .emacs.d/snippets/python-mode/pass delete mode 100644 .emacs.d/snippets/python-mode/scls delete mode 100644 .emacs.d/snippets/python-mode/while delete mode 100644 .emacs.d/snippets/python-mode/with (limited to '.emacs.d') diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el index 9522da4..6775bfa 100644 --- a/.emacs.d/lisp/markdown-mode.el +++ b/.emacs.d/lisp/markdown-mode.el @@ -92,7 +92,7 @@ Any changes to the output buffer made by this hook will be saved.") :group 'text :link '(url-link "https://jblevins.org/projects/markdown-mode/")) -(defcustom markdown-command (let ((command (cl-loop for cmd in '("markdown" "pandoc") +(defcustom markdown-command (let ((command (cl-loop for cmd in '("markdown" "pandoc" "markdown_py") when (executable-find cmd) return (file-name-nondirectory it)))) (or command "markdown")) @@ -9297,15 +9297,23 @@ Create new table lines if required." (unless (markdown-table-at-point-p) (user-error "Not at a table")) (markdown-table-align) - (when (markdown-table-hline-at-point-p) (end-of-line 1)) + (when (markdown-table-hline-at-point-p) (beginning-of-line 1)) (condition-case nil (progn (re-search-backward "\\(?:^\\|[^\\]\\)|" (markdown-table-begin)) + ;; When this function is called while in the first cell in a + ;; table, the point will now be at the beginning of a line. In + ;; this case, we need to move past one additional table + ;; boundary, the end of the table on the previous line. + (when (= (point) (line-beginning-position)) + (re-search-backward "\\(?:^\\|[^\\]\\)|" (markdown-table-begin))) (re-search-backward "\\(?:^\\|[^\\]\\)|" (markdown-table-begin))) (error (user-error "Cannot move to previous table cell"))) - (while (looking-at "|\\([-:]\\|[ \t]*$\\)") - (re-search-backward "\\(?:^\\|[^\\]\\)|" (markdown-table-begin))) - (when (looking-at "| ?") (goto-char (match-end 0)))) + (when (looking-at "\\(?:^\\|[^\\]\\)| ?") (goto-char (match-end 0))) + + ;; This may have dropped point on the hline. + (when (markdown-table-hline-at-point-p) + (markdown-table-backward-cell))) (defun markdown-table-transpose () "Transpose table at point. diff --git a/.emacs.d/snippets/python-mode.statnett/classmethod b/.emacs.d/snippets/python-mode.statnett/classmethod deleted file mode 100644 index aa78440..0000000 --- a/.emacs.d/snippets/python-mode.statnett/classmethod +++ /dev/null @@ -1,10 +0,0 @@ -# -*- mode: snippet -*- -# name: classmethod -# key: cm -# group: object oriented -# -- -@classmethod -def ${1:meth}(cls, $2): - """ - """ - $3 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/cls b/.emacs.d/snippets/python-mode.statnett/cls deleted file mode 100644 index 3dbd391..0000000 --- a/.emacs.d/snippets/python-mode.statnett/cls +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: cls -# key: cls -# group: object oriented -# -- -class ${1:class}(${2:object}): - """""" - $0 diff --git a/.emacs.d/snippets/python-mode.statnett/dec b/.emacs.d/snippets/python-mode.statnett/dec deleted file mode 100644 index b22c9e9..0000000 --- a/.emacs.d/snippets/python-mode.statnett/dec +++ /dev/null @@ -1,14 +0,0 @@ -# -*- mode: snippet -*- -# name: dec -# key: dec -# group : definitions -# -- -def ${1:decorator}(func): - $2 - def _$1(*args, **kwargs): - $3 - ret = func(*args, **kwargs) - $4 - return ret - - return _$1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/function b/.emacs.d/snippets/python-mode.statnett/function deleted file mode 100644 index 5a39d8f..0000000 --- a/.emacs.d/snippets/python-mode.statnett/function +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: function -# key: fn -# group: definitions -# -- -def ${1:fun}(${2:args}): - """""" - $0 diff --git a/.emacs.d/snippets/python-mode.statnett/import b/.emacs.d/snippets/python-mode.statnett/import deleted file mode 100644 index f34bc39..0000000 --- a/.emacs.d/snippets/python-mode.statnett/import +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: import -# key: imp -# group : general -# -- -import ${1:lib}${2: as ${3:alias}} -$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/method b/.emacs.d/snippets/python-mode.statnett/method deleted file mode 100644 index 985ef0c..0000000 --- a/.emacs.d/snippets/python-mode.statnett/method +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: method -# key: m -# group: object oriented -# -- -def ${1:method}(self${2:, $3}): - $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/not_impl b/.emacs.d/snippets/python-mode.statnett/not_impl index 515e353..97a6cb0 100644 --- a/.emacs.d/snippets/python-mode.statnett/not_impl +++ b/.emacs.d/snippets/python-mode.statnett/not_impl @@ -1,5 +1,5 @@ # -*- mode: snippet -*- # name: not_impl -# key: not_impl +# key: ni # -- raise NotImplementedError \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/pass b/.emacs.d/snippets/python-mode.statnett/pass deleted file mode 100644 index 4734f7f..0000000 --- a/.emacs.d/snippets/python-mode.statnett/pass +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: pass -# key: ps -# -- -pass \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/property_getter b/.emacs.d/snippets/python-mode.statnett/property_getter index 8bb99dd..408428a 100644 --- a/.emacs.d/snippets/python-mode.statnett/property_getter +++ b/.emacs.d/snippets/python-mode.statnett/property_getter @@ -7,5 +7,4 @@ def ${1:name}(self): """$1-property""" return self.${2:value} - -$0 +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/property_setter b/.emacs.d/snippets/python-mode.statnett/property_setter index a74be67..aa0288d 100644 --- a/.emacs.d/snippets/python-mode.statnett/property_setter +++ b/.emacs.d/snippets/python-mode.statnett/property_setter @@ -12,4 +12,4 @@ def ${1:name}(self): def $1(self, value): """$1-property setter""" self.$2 = value -$0 +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/scls b/.emacs.d/snippets/python-mode.statnett/scls deleted file mode 100644 index 4a10e28..0000000 --- a/.emacs.d/snippets/python-mode.statnett/scls +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: subclass -# key: scls -# group: object oriented -# -- -class ${1:class}(${2:super-class}): - $0 diff --git a/.emacs.d/snippets/python-mode.statnett/script b/.emacs.d/snippets/python-mode.statnett/script index 3246334..2e8cc35 100644 --- a/.emacs.d/snippets/python-mode.statnett/script +++ b/.emacs.d/snippets/python-mode.statnett/script @@ -3,12 +3,12 @@ # key: script # -- #!/usr/bin/env python +# -*- coding: utf-8 -*- def main(inargs=None): """main entry point""" $0 - -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/.emacs.d/snippets/python-mode.statnett/selfassign b/.emacs.d/snippets/python-mode.statnett/selfassign index 95d7b2b..efdfaa0 100644 --- a/.emacs.d/snippets/python-mode.statnett/selfassign +++ b/.emacs.d/snippets/python-mode.statnett/selfassign @@ -3,4 +3,4 @@ # key: sn # group: object oriented # -- -self.$1 = $1 \ No newline at end of file +self._$1 = $1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/while b/.emacs.d/snippets/python-mode.statnett/while deleted file mode 100644 index 7b3539c..0000000 --- a/.emacs.d/snippets/python-mode.statnett/while +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: while -# key: wh -# group: control structure -# -- -while ${1:True}: - $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode.statnett/with b/.emacs.d/snippets/python-mode.statnett/with deleted file mode 100644 index 7fcbd38..0000000 --- a/.emacs.d/snippets/python-mode.statnett/with +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: with -# key: with -# group : control structure -# -- -with ${1:expr}${2: as ${3:alias}}: - $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/classmethod b/.emacs.d/snippets/python-mode/classmethod deleted file mode 100644 index aa78440..0000000 --- a/.emacs.d/snippets/python-mode/classmethod +++ /dev/null @@ -1,10 +0,0 @@ -# -*- mode: snippet -*- -# name: classmethod -# key: cm -# group: object oriented -# -- -@classmethod -def ${1:meth}(cls, $2): - """ - """ - $3 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/cls b/.emacs.d/snippets/python-mode/cls deleted file mode 100644 index 3dbd391..0000000 --- a/.emacs.d/snippets/python-mode/cls +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: cls -# key: cls -# group: object oriented -# -- -class ${1:class}(${2:object}): - """""" - $0 diff --git a/.emacs.d/snippets/python-mode/dec b/.emacs.d/snippets/python-mode/dec deleted file mode 100644 index b22c9e9..0000000 --- a/.emacs.d/snippets/python-mode/dec +++ /dev/null @@ -1,14 +0,0 @@ -# -*- mode: snippet -*- -# name: dec -# key: dec -# group : definitions -# -- -def ${1:decorator}(func): - $2 - def _$1(*args, **kwargs): - $3 - ret = func(*args, **kwargs) - $4 - return ret - - return _$1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/function b/.emacs.d/snippets/python-mode/function deleted file mode 100644 index 5a39d8f..0000000 --- a/.emacs.d/snippets/python-mode/function +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: function -# key: fn -# group: definitions -# -- -def ${1:fun}(${2:args}): - """""" - $0 diff --git a/.emacs.d/snippets/python-mode/import b/.emacs.d/snippets/python-mode/import deleted file mode 100644 index f34bc39..0000000 --- a/.emacs.d/snippets/python-mode/import +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: import -# key: imp -# group : general -# -- -import ${1:lib}${2: as ${3:alias}} -$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/method b/.emacs.d/snippets/python-mode/method deleted file mode 100644 index 985ef0c..0000000 --- a/.emacs.d/snippets/python-mode/method +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: method -# key: m -# group: object oriented -# -- -def ${1:method}(self${2:, $3}): - $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/not_impl b/.emacs.d/snippets/python-mode/not_impl index 515e353..97a6cb0 100644 --- a/.emacs.d/snippets/python-mode/not_impl +++ b/.emacs.d/snippets/python-mode/not_impl @@ -1,5 +1,5 @@ # -*- mode: snippet -*- # name: not_impl -# key: not_impl +# key: ni # -- raise NotImplementedError \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/pass b/.emacs.d/snippets/python-mode/pass deleted file mode 100644 index 4734f7f..0000000 --- a/.emacs.d/snippets/python-mode/pass +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: pass -# key: ps -# -- -pass \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/property_getter b/.emacs.d/snippets/python-mode/property_getter index 8bb99dd..408428a 100644 --- a/.emacs.d/snippets/python-mode/property_getter +++ b/.emacs.d/snippets/python-mode/property_getter @@ -7,5 +7,4 @@ def ${1:name}(self): """$1-property""" return self.${2:value} - -$0 +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/property_setter b/.emacs.d/snippets/python-mode/property_setter index a74be67..aa0288d 100644 --- a/.emacs.d/snippets/python-mode/property_setter +++ b/.emacs.d/snippets/python-mode/property_setter @@ -12,4 +12,4 @@ def ${1:name}(self): def $1(self, value): """$1-property setter""" self.$2 = value -$0 +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/scls b/.emacs.d/snippets/python-mode/scls deleted file mode 100644 index 4a10e28..0000000 --- a/.emacs.d/snippets/python-mode/scls +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: subclass -# key: scls -# group: object oriented -# -- -class ${1:class}(${2:super-class}): - $0 diff --git a/.emacs.d/snippets/python-mode/script b/.emacs.d/snippets/python-mode/script index ac15584..2e8cc35 100644 --- a/.emacs.d/snippets/python-mode/script +++ b/.emacs.d/snippets/python-mode/script @@ -10,6 +10,5 @@ def main(inargs=None): """main entry point""" $0 - if __name__ == '__main__': main() diff --git a/.emacs.d/snippets/python-mode/selfassign b/.emacs.d/snippets/python-mode/selfassign index 95d7b2b..efdfaa0 100644 --- a/.emacs.d/snippets/python-mode/selfassign +++ b/.emacs.d/snippets/python-mode/selfassign @@ -3,4 +3,4 @@ # key: sn # group: object oriented # -- -self.$1 = $1 \ No newline at end of file +self._$1 = $1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/while b/.emacs.d/snippets/python-mode/while deleted file mode 100644 index 7b3539c..0000000 --- a/.emacs.d/snippets/python-mode/while +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: while -# key: wh -# group: control structure -# -- -while ${1:True}: - $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/with b/.emacs.d/snippets/python-mode/with deleted file mode 100644 index 7fcbd38..0000000 --- a/.emacs.d/snippets/python-mode/with +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: with -# key: with -# group : control structure -# -- -with ${1:expr}${2: as ${3:alias}}: - $0 \ No newline at end of file -- cgit v1.3