From 58e876782fedeeda342aa37791fd28f7bc7b903f Mon Sep 17 00:00:00 2001 From: "Schwaiger, Mario" Date: Wed, 30 Jun 2021 16:09:29 +0200 Subject: [PATCH 01/18] rpdb modified --- rpdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpdb b/rpdb index 47f28ad..718837f 100644 --- a/rpdb +++ b/rpdb @@ -1,5 +1,5 @@ # -*- mode: snippet -*- -# name: remote_pdb (0.0.0.0:4444) +# name: remote_pdb telnet localhost 4444 # key: rpdb # group: debug # -- From ba90c75f274aef49af03802e8565b76b60db626f Mon Sep 17 00:00:00 2001 From: qohelet Date: Thu, 8 Jul 2021 14:57:14 +0200 Subject: [PATCH 02/18] Update README.md Need to put more information on the packages --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 75bd83b..c17b6e4 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,21 @@ with pip. If not, use: ```pip3 install --user black flake8 jedi rope importmagic``` +### Personalized Header Files for Python. +In the IDE.el, look up the line: +```marioschwaiger/yas-python``` +Change the name and whatever is required. This will be the default header for any *.py* File + +## Seriously, what are these things +During the process of constant improvement I notice quite often I do not know myself which of the packages are doing what. If something doesn't behave properly here's what to blame: + + +#### rainbow-delimiters +Colours brackets accordingly and gives a strong visual feedback if brackets are missed + +#### centaur-tabs +Gives emacs tabs like in most modern applications + ### Sphinx-Compatible defs and Shor Do a backup of your .emacs.d/elpa/elpy-20190130.2109/snippets/python-mode/defs From 0af292b637b3378cbf423095881f54110308bb25 Mon Sep 17 00:00:00 2001 From: "Schwaiger, Mario" Date: Wed, 4 Aug 2021 19:09:55 +0200 Subject: [PATCH 03/18] Added treemacs --- IDE.el | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 122 insertions(+), 16 deletions(-) diff --git a/IDE.el b/IDE.el index 0be1708..76bc5af 100644 --- a/IDE.el +++ b/IDE.el @@ -215,12 +215,12 @@ (show-paren-mode 1) ;; A static file list is really cool, like a modern IDE -(package-initialize) -(require 'package) -(add-to-list 'load-path "/home/marioschwaiger/.emacs.d/neotree") -(require 'neotree) -(global-set-key (kbd "C-x M-f") 'neotree-toggle) - (setq neo-window-fixed-size nil) +;;(package-initialize) +;;(require 'package) +;;(add-to-list 'load-path "/home/marioschwaiger/.emacs.d/neotree") +;;(require 'neotree) +;;(global-set-key (kbd "C-x M-f") 'neotree-toggle) +;; (setq neo-window-fixed-size nil) ;; Automatically save and restore sessions (setq desktop-dirname "~/.emacs.d/desktop/" @@ -253,13 +253,13 @@ ) ;; All modern IDEs have the feature to obtain a list of the current documents -(require 'all-the-icons) -(require 'neotree) -(global-set-key [f8] 'neotree-toggle) -(setq neo-theme (if (display-graphic-p) 'icons 'arrow)) +;;(require 'all-the-icons) +;;(require 'neotree) +;;(global-set-key [f8] 'neotree-toggle) +;;(setq neo-theme (if (display-graphic-p) 'icons 'arrow)) ;; I'm a Nerd -(setq neo-theme 'nerd) -(setq neo-vc-integration '(face)) +;;(setq neo-theme 'nerd) +;;(setq neo-vc-integration '(face)) ;; Showing differences to the last Git commit (require 'diff-hl) @@ -364,13 +364,13 @@ buffer in current window." (doom-themes-visual-bell-config) ;; Enable custom neotree theme (all-the-icons must be installed!) -(doom-themes-neotree-config) +;;(doom-themes-neotree-config) ;; or for treemacs users -(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme -(doom-themes-treemacs-config) +;;(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme +;;(doom-themes-treemacs-config) ;; Corrects (and improves) org-mode's native fontification. -(doom-themes-org-config) +;;(doom-themes-org-config) (require 'sublimity) @@ -406,3 +406,109 @@ buffer in current window." ;; Similar for this mode ;; Always start smartparens mode in js-mode. (add-hook 'elpy-mode-hook 'smartparens-mode) + +;; 30.6.21 - Added Treemacs +(use-package treemacs + :ensure t + :defer t + :init + (with-eval-after-load 'winum + (define-key winum-keymap (kbd " SPC") #'treemacs-select-window)) + :config + (progn + (setq treemacs-collapse-dirs (if treemacs-python-executable 3 0) + treemacs-deferred-git-apply-delay 0.5 + treemacs-directory-name-transformer #'identity + treemacs-display-in-side-window nil + treemacs-eldoc-display t + treemacs-file-event-delay 500000 + treemacs-file-extension-regex treemacs-last-period-regex-value + treemacs-file-follow-delay 0.2 + treemacs-file-name-transformer #'identity + treemacs-follow-after-init t + treemacs-expand-after-init t + treemacs-git-command-pipe "" + treemacs-goto-tag-strategy 'refetch-index + treemacs-indentation 2 + treemacs-indentation-string " " + treemacs-is-never-other-window nil + treemacs-max-git-entries 5000 + treemacs-missing-project-action 'ask + treemacs-move-forward-on-expand nil + treemacs-no-png-images nil + treemacs-no-delete-other-windows t + treemacs-project-follow-cleanup nil + treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory) + treemacs-position 'left + treemacs-read-string-input 'from-child-frame + treemacs-recenter-distance 0.1 + treemacs-recenter-after-file-follow nil + treemacs-recenter-after-tag-follow nil + treemacs-recenter-after-project-jump 'always + treemacs-recenter-after-project-expand 'on-distance + treemacs-litter-directories '("/node_modules" "/.venv" "/.cask") + treemacs-show-cursor nil + treemacs-show-hidden-files t + treemacs-silent-filewatch nil + treemacs-silent-refresh nil + treemacs-sorting 'alphabetic-asc + treemacs-space-between-root-nodes t + treemacs-tag-follow-cleanup t + treemacs-tag-follow-delay 1.5 + treemacs-user-mode-line-format nil + treemacs-user-header-line-format nil + treemacs-width 35 + treemacs-width-is-initially-locked nil + treemacs-workspace-switch-cleanup nil) + + ;; The default width and height of the icons is 22 pixels. If you are + ;; using a Hi-DPI display, uncomment this to double the icon size. + ;;(treemacs-resize-icons 44) + + (treemacs-follow-mode t) + (treemacs-filewatch-mode t) + (treemacs-fringe-indicator-mode 'always) + (pcase (cons (not (null (executable-find "git"))) + (not (null treemacs-python-executable))) + (`(t . t) + (treemacs-git-mode 'deferred)) + (`(t . _) + (treemacs-git-mode 'simple)))) + :bind + (:map global-map + ("M-0" . treemacs-select-window) + ("C-x t 1" . treemacs-delete-other-windows) + ("C-x t t" . treemacs) + ("C-x t B" . treemacs-bookmark) + ("C-x t C-t" . treemacs-find-file) + ("C-x t M-t" . treemacs-find-tag))) + +;;(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action) +(with-eval-after-load 'treemacs + (define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action)) +(use-package treemacs-projectile + :after (treemacs projectile) + :ensure t) + +(use-package treemacs-icons-dired + :after (treemacs dired) + :ensure t + :config (treemacs-icons-dired-mode)) + +(use-package treemacs-magit + :after (treemacs magit) + :ensure t) + +(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode + :after (treemacs persp-mode) ;;or perspective vs. persp-mode + :ensure t + :config (treemacs-set-scope-type 'Perspectives)) + +(add-hook 'emacs-startup-hook 'treemacs) + +(use-package auto-package-update + :ensure t + :config + (setq auto-package-update-delete-old-versions t + auto-package-update-interval 4) + (auto-package-update-maybe)) From 0a11d893aef05b72482112ca923e4994de6bfaff Mon Sep 17 00:00:00 2001 From: "Schwaiger, Mario" Date: Mon, 11 Oct 2021 13:32:07 +0200 Subject: [PATCH 04/18] set ipdb --- dph | 2 +- ipdb | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dph b/dph index 0ad5280..26bc517 100644 --- a/dph +++ b/dph @@ -10,7 +10,7 @@ ############################################# __author__ = "Mario Schwaiger" __copyright__ = "Copyright `(format-time-string "%Y")`$0, Virtual Vehicle" -__credits__ = ["Stefan Reiterer", "Mario Schwaiger", "Michael Kalab", "Angelika More"] +__credits__ = ["Stefan Reiterer", "Mario Schwaiger", "Angelika More"] __version__ = "0.1" __maintainer__ = "Mario Schwaiger" __email__ = "mario.schwaiger@v2c2.at" diff --git a/ipdb b/ipdb index 31edbe6..356a4d0 100755 --- a/ipdb +++ b/ipdb @@ -1,2 +1,10 @@ -#!/bin/bash -ipython3 --simple-prompt -c "%run -d $@" +# -*- mode: snippet; require-final-newline: nil -*- +# name: ipdb trace +# key: ipdb +# group: debug +# -- +# fmt: off +#`(format-time-string "%d.%m.%Y %H:%M")`$0 +import ipdb +ipdb.set_trace() # NOQA +# fmt: on From 1bf33ba7a1f02681a51cd2968f33760c0d0d2d79 Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Thu, 19 May 2022 10:42:22 +0200 Subject: [PATCH 05/18] Added JSON Mode --- IDE.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IDE.el b/IDE.el index 76bc5af..77b8986 100644 --- a/IDE.el +++ b/IDE.el @@ -37,7 +37,7 @@ docker-compose-mode org markdown-mode -;; neotree + sphinx-doc all-the-icons use-package highlight-symbol @@ -52,6 +52,7 @@ centaur-tabs rainbow-delimiters ;;12.4.21 smartparens;;12.4.21 + json-mode;;19.5. )) ;; org mode @@ -512,3 +513,9 @@ buffer in current window." (setq auto-package-update-delete-old-versions t auto-package-update-interval 4) (auto-package-update-maybe)) + + +;;This is used for the Autodoc +(add-hook 'python-mode-hook (lambda () + (require 'sphinx-doc) + (sphinx-doc-mode t))) From 7c20ddd188183b4c8548564ecb20098241e55bce Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Tue, 31 May 2022 16:22:03 +0200 Subject: [PATCH 06/18] https://emacs.stackexchange.com/questions/71954/symbols-function-definition-is-void-python-font-lock-assignment-matcher?noredirect=1#comment116306_71954 --- IDE.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/IDE.el b/IDE.el index 77b8986..2aebb0e 100644 --- a/IDE.el +++ b/IDE.el @@ -129,13 +129,9 @@ (define-key global-map (kbd "s-") 'next-buffer) ;; switch to next buffer (define-key global-map (kbd "s-") 'previous-buffer) ;; switch to previous buffer -;;) -;;(require 'ido -;;(ido-mode t) -(require 'python-mode) -;;(add-hook 'python-mode-hook 'anaconda-mode) -;;(add-hook 'python-mode-hook 'anaconda-eldoc-mode) -;; add scons file to the known python file list +;;python instead of python-mode (31.5.) +;;https://emacs.stackexchange.com/q/71954/21383 +(require 'python) (add-to-list 'auto-mode-alist '("\\SConstruct\\'" . python-mode)) ;; Normal Copy paste From 2f6bde1d1318aec8218ca711fb2c328ec0f9d65a Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Wed, 1 Jun 2022 09:06:48 +0200 Subject: [PATCH 07/18] Finally used that Snippets folder --- defs => snippets/defs | 0 dph => snippets/dph | 0 ipdb => snippets/ipdb | 0 pdbpm => snippets/pdbpm | 0 rpdb => snippets/rpdb | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename defs => snippets/defs (100%) rename dph => snippets/dph (100%) rename ipdb => snippets/ipdb (100%) rename pdbpm => snippets/pdbpm (100%) rename rpdb => snippets/rpdb (100%) diff --git a/defs b/snippets/defs similarity index 100% rename from defs rename to snippets/defs diff --git a/dph b/snippets/dph similarity index 100% rename from dph rename to snippets/dph diff --git a/ipdb b/snippets/ipdb similarity index 100% rename from ipdb rename to snippets/ipdb diff --git a/pdbpm b/snippets/pdbpm similarity index 100% rename from pdbpm rename to snippets/pdbpm diff --git a/rpdb b/snippets/rpdb similarity index 100% rename from rpdb rename to snippets/rpdb From c93f6d89315ae7c1363fc6bd20bb2dd57c6e89db Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Thu, 18 Aug 2022 13:45:01 +0200 Subject: [PATCH 08/18] Added Snipscript --- set_snippets.sh | 8 ++++++++ snippets/dph | 17 ----------------- 2 files changed, 8 insertions(+), 17 deletions(-) create mode 100755 set_snippets.sh delete mode 100644 snippets/dph diff --git a/set_snippets.sh b/set_snippets.sh new file mode 100755 index 0000000..e3a5ee7 --- /dev/null +++ b/set_snippets.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# elpa/elpy-20220627.1416/ +FILPA=$(pwd) +cd elpa +ELPY=$(ls -d elpy*) +LONGPA=${ELPY}/snippets/python-mode/ +cd .. +for file in snippets/*; do ln -s "$(pwd)/${file}" "${FILPA}/elpa/${LONGPA}"; done diff --git a/snippets/dph b/snippets/dph deleted file mode 100644 index 26bc517..0000000 --- a/snippets/dph +++ /dev/null @@ -1,17 +0,0 @@ -# name: do_python_header -# key: dph -# -- -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -############################################# -# Author: Mario Schwaiger # -# Email: mario.schwaiger@v2c2.at # -# Created: `(format-time-string "%d.%m.%Y %H:%M")`$0 # -############################################# -__author__ = "Mario Schwaiger" -__copyright__ = "Copyright `(format-time-string "%Y")`$0, Virtual Vehicle" -__credits__ = ["Stefan Reiterer", "Mario Schwaiger", "Angelika More"] -__version__ = "0.1" -__maintainer__ = "Mario Schwaiger" -__email__ = "mario.schwaiger@v2c2.at" -__status__ = "Development" From 4637e889b5a06d88cffb4b897069408e023a9046 Mon Sep 17 00:00:00 2001 From: qohelet Date: Thu, 18 Aug 2022 14:03:25 +0200 Subject: [PATCH 09/18] Update README.md Using Scripts makes everything easier --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index c17b6e4..e217db6 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,7 @@ Gives emacs tabs like in most modern applications Do a backup of your .emacs.d/elpa/elpy-20190130.2109/snippets/python-mode/defs Then do symbolic links. pdbpm, dph and rpdb are useful shortcuts for debugging-features which are not defined by default: ``` -ln -s /home/$USER/.emacs.d/defs /home/$USER/.emacs.d/elpa/elpy-DATE.VERSION/snippets/python-mode/defs -ln -s /home/$USER/.emacs.d/pdbpm /home/$USER/.emacs.d/elpa/elpy-DATE.VERSION/snippets/python-mode/pdbpm -ln -s /home/$USER/.emacs.d/dph /home/$USER/.emacs.d/elpa/elpy-DATE.VERSIO/snippets/python-mode/ -ln -s /home/$USER/.emacs.d/rpdb /home/$USER/.emacs.d/elpa/elpy-DATE.VERSIO/snippets/python-mode/ +~/.emacs.d$ ./set_snippets.sh ``` From d8a6e19cce169f92eb59bb881ad89c35bc3eae99 Mon Sep 17 00:00:00 2001 From: qohelet Date: Mon, 22 Aug 2022 15:21:57 +0200 Subject: [PATCH 10/18] Update README.md ~/.emacs.d$ ./set_snippets.sh --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e217db6..f72f41f 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ $ git clone https://github.com/maldun/emacs_python_ide .emacs.d/ #Adding: $ echo '(setq IDE-path "~/.emacs.d/")' >> .emacs $ echo "(load (mapconcat 'identity (list IDE-path \"IDE.el\") \"\"))" >> .emacs +$ ./set_snippets.sh $ emacs #Have fun, but this might take just a little ``` From 796cefecbfa65371c4a03a6018e0345abd19fded Mon Sep 17 00:00:00 2001 From: qohelet Date: Mon, 22 Aug 2022 15:22:21 +0200 Subject: [PATCH 11/18] Update README.md Wrong dict --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f72f41f..5b97291 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ $ git clone https://github.com/maldun/emacs_python_ide .emacs.d/ #Adding: $ echo '(setq IDE-path "~/.emacs.d/")' >> .emacs $ echo "(load (mapconcat 'identity (list IDE-path \"IDE.el\") \"\"))" >> .emacs -$ ./set_snippets.sh +$ cd .emacs.d && ./set_snippets.sh $ emacs #Have fun, but this might take just a little ``` From 828b93e842ea4f32054c34e0aec876b0eac59741 Mon Sep 17 00:00:00 2001 From: qohelet Date: Mon, 22 Aug 2022 15:32:18 +0200 Subject: [PATCH 12/18] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5b97291..55a682c 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ $ git clone https://github.com/maldun/emacs_python_ide .emacs.d/ #Adding: $ echo '(setq IDE-path "~/.emacs.d/")' >> .emacs $ echo "(load (mapconcat 'identity (list IDE-path \"IDE.el\") \"\"))" >> .emacs -$ cd .emacs.d && ./set_snippets.sh -$ emacs #Have fun, but this might take just a little +$ emacs #Have fun, but this might take just a little, but you have to exit again if you want the snippets to be set +$ cd .emacs.d && chmod +x set_snippets.sh &&./set_snippets.sh #Now all the folders exist ``` to your .emacs From c9ebb76a58100d817c7de03cc4f7013a24a37bee Mon Sep 17 00:00:00 2001 From: "Schwaiger, Mario" Date: Mon, 22 Aug 2022 17:45:11 +0200 Subject: [PATCH 13/18] Added dph --- set_snippets.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++-- snippets/dph | 17 +++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 snippets/dph diff --git a/set_snippets.sh b/set_snippets.sh index e3a5ee7..7f55a6b 100755 --- a/set_snippets.sh +++ b/set_snippets.sh @@ -1,8 +1,51 @@ -#!/bin/bash +#!/bin/bash # elpa/elpy-20220627.1416/ FILPA=$(pwd) cd elpa ELPY=$(ls -d elpy*) LONGPA=${ELPY}/snippets/python-mode/ cd .. -for file in snippets/*; do ln -s "$(pwd)/${file}" "${FILPA}/elpa/${LONGPA}"; done + +for file in snippets/*; do + ORIGFILE=$(pwd)/${file} + FULLFILE=${FILPA}/elpa/${LONGPA}$(basename ${file}) + OLDFILE=${FULLFILE}_old + if [ -L ${FULLFILE} ] ; then + if [ -e ${FULLFILE} ] ; then + echo "Good link: ${FULLFILE} " + if [ -f ${OLDFILE} ]; then + echo ${OLDFILE} + rm ${OLDFILE} + fi + mv ${FULLFILE} ${OLDFILE} + + else + echo "Broken link: ${FULLFILE} " + rm ${FULLFILE} + fi + elif [ -e ${FULLFILE} ] ; then + echo "Not a link: ${FULLFILE}" + if [ -f ${OLDFILE} ]; then + echo ${OLDFILE} + rm ${OLDFILE} + fi + mv ${FULLFILE} ${OLDFILE} + else + echo "Missing: ${FULLFILE}" + fi + + ln -s ${ORIGFILE} ${FULLFILE} +done + +# if [ -L ${FULLFILE} ] && [ -e ${FULLFILE} ]; then +# OLDFILE=${FULLFILE}_old +# if [ -L ${OLDFILE} ] && [ -e ${OLDFILE} ]; then +# echo ${OLDFILE} +# rm ${OLDFILE} +# fi +# echo ${FULLFILE} +# mv ${FULLFILE} ${OLDFILE} +# else +# ln -s ${ORIGFILE} ${FULLFILE}; +# fi +#done diff --git a/snippets/dph b/snippets/dph new file mode 100644 index 0000000..424ad5a --- /dev/null +++ b/snippets/dph @@ -0,0 +1,17 @@ +# name: do_python_header +# key: dph +# -- +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +############################################# +# Author: Mario Schwaiger # +# Email: mario.schwaiger@v2c2.at # +# Created: `(format-time-string "%d.%m.%Y %H:%M")`$0 # +############################################# +__author__ = "Mario Schwaiger" +__copyright__ = "Copyright `(format-time-string "%Y")`$0, Virtual Vehicle" +__credits__ = ["Stefan Reiterer", "Mario Schwaiger"] +__version__ = "0.1" +__maintainer__ = "Mario Schwaiger" +__email__ = "mario.schwaiger@v2c2.at" +__status__ = "Development" From 105fd394937853ff4c00ee65d68a831181416e85 Mon Sep 17 00:00:00 2001 From: "Schwaiger, Mario" Date: Mon, 22 Aug 2022 18:13:39 +0200 Subject: [PATCH 14/18] dph set --- IDE.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IDE.el b/IDE.el index 2aebb0e..a740c3b 100644 --- a/IDE.el +++ b/IDE.el @@ -315,7 +315,7 @@ buffer in current window." (defun marioschwaiger/yas-python () (interactive) ;; (yas-expand-snippet (yas-lookup-snippet "cmake_minimum_required" 'cmake-mode))) - (yas-expand-snippet (yas-lookup-snippet "do_python_header" 'python-mode))) + (yas-expand-snippet (yas-lookup-snippet "dph" 'python-mode))) (use-package autoinsert From 7596fbd756f681667afd5f816b095fdb83cc5ed0 Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Wed, 7 Sep 2022 18:01:45 +0200 Subject: [PATCH 15/18] -l and -c --- set_snippets.sh | 79 +++++++++++++++++++++++++++++++++++++------------ snippets/ipdb | 1 + 2 files changed, 61 insertions(+), 19 deletions(-) mode change 100755 => 100644 snippets/ipdb diff --git a/set_snippets.sh b/set_snippets.sh index 7f55a6b..583d293 100755 --- a/set_snippets.sh +++ b/set_snippets.sh @@ -1,5 +1,38 @@ #!/bin/bash # elpa/elpy-20220627.1416/ + +#If /set_snippets.sh -c is called nothing happens, just checking + + +CHECKONLY=1 + +if [ "$#" -eq "0" ] ; then +# echo "No arguments supplied" + CHECKONLY=1 +else + if [ ! -z "$1" ] ; then + if [ "$1" == "-c" ] ; then +# echo "P1 is -c" + CHECKONLY=0 + echo "ReadOnly Mode" + else +# echo "P1 is not -c" +# echo "P1 is {$1}" + CHECKONLY=1 + fi + else +# echo "P1 is not set" + CHECKONLY=1 + fi +fi + +#echo ${CHECKONLY} +#echo "$1" + +if [ "$1" = "-l" ] ; then + echo "Delete Mode" +fi + FILPA=$(pwd) cd elpa ELPY=$(ls -d elpy*) @@ -12,40 +45,48 @@ for file in snippets/*; do OLDFILE=${FULLFILE}_old if [ -L ${FULLFILE} ] ; then if [ -e ${FULLFILE} ] ; then - echo "Good link: ${FULLFILE} " + echo "Good link: ${FULLFILE} " + #Check option -c + if [ "$CHECKONLY" = 1 ] ; then if [ -f ${OLDFILE} ]; then echo ${OLDFILE} rm ${OLDFILE} fi - mv ${FULLFILE} ${OLDFILE} - + if [ "$1" = "-l" ] ; then + echo "Remove set removing: ${FULLFILE} " + rm ${FULLFILE} + else + echo "Moving to old_file instead of deleting" + mv ${FULLFILE} ${OLDFILE} + fi + fi + else - echo "Broken link: ${FULLFILE} " + echo "Broken link: ${FULLFILE} " + if [ "$CHECKONLY" = 1 ] ; then + echo "rm ${FULLFILE}" rm ${FULLFILE} + fi fi elif [ -e ${FULLFILE} ] ; then - echo "Not a link: ${FULLFILE}" + echo "Not a link: ${FULLFILE}" + if [ "$CHECKONLY" = 1 ] ; then if [ -f ${OLDFILE} ]; then echo ${OLDFILE} rm ${OLDFILE} fi + echo "Moving as it's not a link" mv ${FULLFILE} ${OLDFILE} + fi else echo "Missing: ${FULLFILE}" fi - - ln -s ${ORIGFILE} ${FULLFILE} + + if [ "$CHECKONLY" = 1 ] ; then + echo "Setting Link" + ln -s ${ORIGFILE} ${FULLFILE} + fi done -# if [ -L ${FULLFILE} ] && [ -e ${FULLFILE} ]; then -# OLDFILE=${FULLFILE}_old -# if [ -L ${OLDFILE} ] && [ -e ${OLDFILE} ]; then -# echo ${OLDFILE} -# rm ${OLDFILE} -# fi -# echo ${FULLFILE} -# mv ${FULLFILE} ${OLDFILE} -# else -# ln -s ${ORIGFILE} ${FULLFILE}; -# fi -#done + + diff --git a/snippets/ipdb b/snippets/ipdb old mode 100755 new mode 100644 index 356a4d0..ad69a2b --- a/snippets/ipdb +++ b/snippets/ipdb @@ -8,3 +8,4 @@ import ipdb ipdb.set_trace() # NOQA # fmt: on + From 8f607cac77ca30fe10e937db2192a578c9c6f065 Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Wed, 7 Sep 2022 18:23:41 +0200 Subject: [PATCH 16/18] Added -p --- set_snippets.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/set_snippets.sh b/set_snippets.sh index 583d293..f6372f2 100755 --- a/set_snippets.sh +++ b/set_snippets.sh @@ -32,6 +32,9 @@ fi if [ "$1" = "-l" ] ; then echo "Delete Mode" fi +if [ "$1" = "-p" ] ; then + echo "Persistent Mode" +fi FILPA=$(pwd) cd elpa @@ -83,8 +86,13 @@ for file in snippets/*; do fi if [ "$CHECKONLY" = 1 ] ; then - echo "Setting Link" - ln -s ${ORIGFILE} ${FULLFILE} + if [ "$1" = "-p" ] ; then + echo "Moving: ${ORIGFILE} ${FULLFILE}" + cp ${ORIGFILE} ${FULLFILE} + else + echo "Setting Link ${ORIGFILE} ${FULLFILE}" + ln -s ${ORIGFILE} ${FULLFILE} + fi fi done From afbb1a824a509f84f36b1f99fc7611814fdb0f43 Mon Sep 17 00:00:00 2001 From: "Mario J. Schwaiger" Date: Thu, 8 Sep 2022 10:37:18 +0200 Subject: [PATCH 17/18] Everything fixed --- IDE.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IDE.el b/IDE.el index a740c3b..4a63083 100644 --- a/IDE.el +++ b/IDE.el @@ -179,9 +179,9 @@ (setq python-shell-interpreter "ipython3" python-shell-interpreter-args "--simple-prompt -i") -(message "Link snippets") -(setq snip1 "defs") -(setq snip2 "dph") +;(message "Link snippets") +(setq snip1 "snippets/defs") +(setq snip2 "snippets/dph") (setq middle "elpa/elpy-*/snippets/python-mode/") (setq path-helper1 (mapconcat 'identity (list IDE-path middle) "")) From 853c8eaacd028faf5677c5e42ba0204aefa37ec7 Mon Sep 17 00:00:00 2001 From: qohelet Date: Thu, 8 Sep 2022 10:40:05 +0200 Subject: [PATCH 18/18] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 55a682c..6a68faf 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,18 @@ Do a backup of your .emacs.d/elpa/elpy-20190130.2109/snippets/python-mode/defs Then do symbolic links. pdbpm, dph and rpdb are useful shortcuts for debugging-features which are not defined by default: ``` ~/.emacs.d$ ./set_snippets.sh +``` +## Snippets +Bear in mind there are (at least) two folders for snippets: +``` +./elpa/elpy-20*.*/snippets/python-mode/ +``` +For all the short-cuts that are used in everyday-programming +``` +./elpa/yasnippet-snippets-20*.*/snippets/emacs-lisp-mode/ ``` +That is used for instance if a new file is create and the snippet dph is ran against it. The remote_pdb (rpdb) in its currenct configuration can be accessed with the following command: ```$ telnet localhost 4444```