Skip to content

Commit

Permalink
completing py-xyz commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Detlef Groth committed Dec 21, 2024
1 parent bff0f2b commit feae73a
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 31 deletions.
84 changes: 70 additions & 14 deletions doc/me.smd
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,9 @@
[print-scheme(2)](print-scheme(2)) Create a new printer color and font scheme
[print-setup(3)](print-setup(3)) Configure MicroEmacs's printer interface
[py-doc(3)](py-doc(3)) Display Python module manual pages
[py-exec(3)](py-exec(3)) Executes the current Python script with or without command line arguments
[py-format(3)](py-format(3)) Format Python source code using either black or yapf
[py-lint(3)](py-lint(3)) Check a Python script file for possible problems
[query-replace-all-string(3)](query-replace-all-string(3)) Query replace string in a list of files
[query-replace-string(2)](query-replace-string(2)) (esc C-r) Search and replace a string - with query
[query-replace-string-in-files(3)](query-replace-string-in-files(3)) Conditionally search and replace strings
Expand Down Expand Up @@ -2627,7 +2629,9 @@
[password-to-phonic(3)](password-to-phonic(3)) Convert a password to phonic string
[print-setup(3)](print-setup(3)) Configure MicroEmacs's printer interface
[py-doc(3)](py-doc(3)) Display Python module manual pages
[py-exec(3)](py-exec(3)) Executes the current Python script with or without command line arguments
[py-format(3)](py-format(3)) Format Python source code using either black or yapf
[py-lint(3)](py-lint(3)) Check a Python script file for possible problems
[query-replace-all-string(3)](query-replace-all-string(3)) Query replace string in a list of files
[query-replace-string-in-files(3)](query-replace-string-in-files(3)) Conditionally search and replace strings across files
[rdiff(3)](rdiff(3)) Recursively compare files or directories
Expand Down Expand Up @@ -3775,7 +3779,9 @@
[profile(9)](profile(9)) Shell user profile
[py(9)](py(9)) Python Language File
[py-doc(3)](py-doc(3)) Display Python module manual pages
[py-exec(3)](py-exec(3)) Executes the current Python script with or without command line arguments
[py-format(3)](py-format(3)) Format Python source code using either black or yapf
[py-lint(3)](py-lint(3)) Check a Python script file for possible problems
[python(9)](python(9)) Python Language File
[query-replace-all-string(3)](query-replace-all-string(3)) Query replace string in a list of files
[query-replace-string(2)](query-replace-string(2)) (esc C-r) Search and replace a string - with query
Expand Down Expand Up @@ -43516,50 +43522,100 @@ $a
[r(9)](r(9))
!! me-id: m3mac100
! 3 py-doc
! 3 py-exec
! 3 py-format
! 3 py-lint
! 5 .py-lint.lint
## NAME


|py-doc
py-doc - display documentation for Python modules and packages
|py-exec
py-exec - executes the current Python script with or without command line arguments
|py-format
py-format - format Python source code using either black or yapf
|py-lint
py-lint - check a Python script file for possible problems
|.py-lint.lint
.py-lint.lint - linting command to be executed, default: yapf or back
$a

## SYNOPSIS

__py-doc__ ["package|function"]
__py-format__
_n_ __py-exec__
__py-format__
__py-lint__
set-variable _.py-lint.lint_ "_string_"


## DESCRIPTION

__py-doc__ displays the manual page for a Python package module or package
within MicroEmacs..
The __py-doc__ macro displays the manual page for a Python package module or
package within MicroEmacs.

You can fold or unfold the section and use the [item-list(3)](item-list(3))
command to get an overview about section and classes in a module or
package. If no argment is given requests a package or function name from
the user via the command line.
You can fold or unfold the section and use the [item-list(3)](item-list(3)) command
to get an overview about section and classes in a module or package.
If no argument is given requests a package or function name from the
user is requested via the message line.

The __py-format__ macro formats the currently edited file using one of the
Python formatters either `yapf` or `black`. You can usually install these
application using your systems package manager or using the pip package
manager. To set your formatter to "black" even if you have "yapf" installed,
you can change the value of the variable _.py-format.format_ to "black".


## EXAMPLE
The __py-lint__ macro checks the currently edited file using the Python
package tool `pylint` which must be installed by the user for instance using
the standard package manager or using the Python package manager pip like
this:

pip install pylint --user

After executing the macro __py-lint__ a popup-window (`*pylint*`) displays the
warning messages of the `pylint` program, the user can click on the hilighted
lines showing warnings and jump directly to the problematic line. The same
can be achieved by pressing th ENTER key on the highlighted line using
the keyboard navigating to the warning or error line and pressing the ENTER key.

Setting the variable _.py-lint.lint_ allows you to customize the linter
settings.

The __py-exec__ macro executed the currently edited file using the python3
command line interpreter. If any numeric argument is given before calling
the script, then the user is asked for command line arguments which should
be given on the message line.

After executing the macro a popup-window (`*pyexec*`) displays the results
of the script execution. The user can click on the hilighted lines showing
warnings and jump directly to the problematic line in the source script. The
same can be achieved by pressing the ENTER key on the highlighted line using
the keyboard.

## EXAMPLES

```{.emf}
py-doc "argparse" ; load the documentation of argparse module
py-doc "sys"
py-format ; formats the current Python file using yapf (or black)
set-variable .py-format.format "black"
py-doc "argparse" ; load the documentation of argparse module
py-doc "sys"
py-format ; formats the current Python file using yapf (or black)
set-variable .py-format.format "black"
```

Here an example to lint the currently edited Python script.

```{.emf}
; by modifying the macro variable .py-lint.lint
; you can add no standard options to pylint like here
set-variable .py-lint.lint "pylint --docstring-min-length 20 %s"
; during editing an Python file press Esc x and then execute
py-lint
```

## NOTES

The __py-doc__ and the __py-format__ macros are defined in the file `pytools.emf`.
The __py-doc__, __py-exec__, __py-format__ and __py-lint__ macros are defined in the
file `pytools.emf`.

## SEE ALSO

Expand Down
86 changes: 71 additions & 15 deletions jasspa/macros/me.ehf
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,9 @@ Miscellaneous Information
lsprint-scheme(2)lmprint-scheme(2)le Create a new printer color and font scheme
lsprint-setup(3)lmprint-setup(3)le Configure MicroEmacs's printer interface
lspy-doc(3)lmpy-doc(3)le Display Python module manual pages
lspy-exec(3)lmpy-exec(3)le Executes the current Python script with or without command line arguments
lspy-format(3)lmpy-format(3)le Format Python source code using either black or yapf
lspy-lint(3)lmpy-lint(3)le Check a Python script file for possible problems
lsquery-replace-all-string(3)lmquery-replace-all-string(3)le Query replace string in a list of files
lsquery-replace-string(2)lmquery-replace-string(2)le (esc C-r) Search and replace a string - with query
lsquery-replace-string-in-files(3)lmquery-replace-string-in-files(3)le Conditionally search and replace strings
Expand Down Expand Up @@ -2709,7 +2711,9 @@ Miscellaneous Information
lspassword-to-phonic(3)lmpassword-to-phonic(3)le Convert a password to phonic string
lsprint-setup(3)lmprint-setup(3)le Configure MicroEmacs's printer interface
lspy-doc(3)lmpy-doc(3)le Display Python module manual pages
lspy-exec(3)lmpy-exec(3)le Executes the current Python script with or without command line arguments
lspy-format(3)lmpy-format(3)le Format Python source code using either black or yapf
lspy-lint(3)lmpy-lint(3)le Check a Python script file for possible problems
lsquery-replace-all-string(3)lmquery-replace-all-string(3)le Query replace string in a list of files
lsquery-replace-string-in-files(3)lmquery-replace-string-in-files(3)le Conditionally search and replace strings across files
lsrdiff(3)lmrdiff(3)le Recursively compare files or directories
Expand Down Expand Up @@ -3854,7 +3858,9 @@ Miscellaneous Information
lsprofile(9)lmprofile(9)le Shell user profile
lspy(9)lmpy(9)le Python Language File
lspy-doc(3)lmpy-doc(3)le Display Python module manual pages
lspy-exec(3)lmpy-exec(3)le Executes the current Python script with or without command line arguments
lspy-format(3)lmpy-format(3)le Format Python source code using either black or yapf
lspy-lint(3)lmpy-lint(3)le Check a Python script file for possible problems
lspython(9)lmpython(9)le Python Language File
lsquery-replace-all-string(3)lmquery-replace-all-string(3)le Query replace string in a list of files
lsquery-replace-string(2)lmquery-replace-string(2)le (esc C-r) Search and replace a string - with query
Expand Down Expand Up @@ -42936,48 +42942,98 @@ $a

lsr(9)lmr(9)le
! 3 py-doc
! 3 py-exec
! 3 py-format
! 3 py-lint
! 5 .py-lint.lint
cEcENAME cEcA


|py-doc
py-doc - display documentation for Python modules and packages
|py-exec
py-exec - executes the current Python script with or without command line arguments
|py-format
py-format - format Python source code using either black or yapf
|py-lint
py-lint - check a Python script file for possible problems
|.py-lint.lint
.py-lint.lint - linting command to be executed, default: yapf or back
$a

cESYNOPSIS cA

cDpy-doccA ["package|function"]
cDpy-formatcA
cCncA cDpy-execcA
cDpy-formatcA
cDpy-lintcA
set-variable cC.py-lint.lintcA "cCstringcA"


cEDESCRIPTION cA

cDpy-doccA displays the manual page for a Python package module or package
within MicroEmacs..
The cDpy-doccA macro displays the manual page for a Python package module or
package within MicroEmacs.

You can fold or unfold the section and use the lsitem-list(3)lmitem-list(3)le
command to get an overview about section and classes in a module or
package. If no argment is given requests a package or function name from
the user via the command line.
You can fold or unfold the section and use the lsitem-list(3)lmitem-list(3)le command
to get an overview about section and classes in a module or package.
If no argument is given requests a package or function name from the
user is requested via the message line.

The cDpy-formatcA macro formats the currently edited file using one of the
Python formatters either cGyapfcA or cGblackcA. You can usually install these
application using your systems package manager or using the pip package
manager. To set your formatter to "black" even if you have "yapf" installed,
you can change the value of the variable cC.py-format.formatcA to "black".


cEEXAMPLE cA
The cDpy-lintcA macro checks the currently edited file using the Python
package tool cGpylintcA which must be installed by the user for instance using
the standard package manager or using the Python package manager pip like
this:

py-doc "argparse" ; load the documentation of argparse module
py-doc "sys"
py-format ; formats the current Python file using yapf (or black)
set-variable .py-format.format "black"

pip install pylint --user

After executing the macro cDpy-lintcA a popup-window (cG*pylint*cA) displays the
warning messages of the cGpylintcA program, the user can click on the hilighted
lines showing warnings and jump directly to the problematic line. The same
can be achieved by pressing th ENTER key on the highlighted line using
the keyboard navigating to the warning or error line and pressing the ENTER key.

Setting the variable cC.py-lint.lintcA allows you to customize the linter
settings.

The cDpy-execcA macro executed the currently edited file using the python3
command line interpreter. If any numeric argument is given before calling
the script, then the user is asked for command line arguments which should
be given on the message line.

After executing the macro a popup-window (cG*pyexec*cA) displays the results
of the script execution. The user can click on the hilighted lines showing
warnings and jump directly to the problematic line in the source script. The
same can be achieved by pressing the ENTER key on the highlighted line using
the keyboard.

cEEXAMPLES cA

sB
py-doc "argparse" ; load the documentation of argparse module
py-doc "sys"
py-format ; formats the current Python file using yapf (or black)
set-variable .py-format.format "black"
sA
Here an example to lint the currently edited Python script.

sB
; by modifying the macro variable .py-lint.lint
; you can add no standard options to pylint like here
set-variable .py-lint.lint "pylint --docstring-min-length 20 %s"
; during editing an Python file press Esc x and then execute
py-lint
sA
cENOTES cA

The cDpy-doccA and the cDpy-formatcA macros are defined in the file cGpytools.emfcA.
The cDpy-doccA, cDpy-execcA, cDpy-formatcA and cDpy-lintcA macros are defined in the
file cGpytools.emfcA.

cESEE ALSO cA

Expand Down
2 changes: 1 addition & 1 deletion jasspa/macros/me.emf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define-macro-file fileopen osd-file-open osd-get-file
define-macro-file spellaut auto-spell auto-spell-menu
define-macro-file hkinfo info info-on info-goto-link
define-macro-file rtools r-doc r-format r-lint r-exec
define-macro-file pytools py-doc py-format
define-macro-file pytools py-doc py-format py-lint py-exec
define-macro-file zfile find-zfile zfile-setup
define-macro-file gentags generate-tags-file
define-macro-file dmf display-matching-fence
Expand Down
Loading

0 comments on commit feae73a

Please sign in to comment.