Skip to content

Emacs guide update#6692

Merged
pllim merged 3 commits into
astropy:masterfrom
mhvk:emacs-guide-update
Oct 14, 2017
Merged

Emacs guide update#6692
pllim merged 3 commits into
astropy:masterfrom
mhvk:emacs-guide-update

Conversation

@mhvk

@mhvk mhvk commented Oct 8, 2017

Copy link
Copy Markdown
Contributor

fixes #6568.

This PR has two commits, one that directly addresses #6568, and one that greatly simplifies the guide - I think we should stick to things that are actually needed rather than try to give all kinds of tips & tricks (also, quite a few of the things listed were incorrect or not needed; see in-line comments). Instead, I now added a link to instructions on how to use emacs as an IDE.

p.s. I could be convinced to put the "tricks" back in a separate "tips & tricks" section. But at least to me none of them seemed particularly useful...

@astropy-bot

astropy-bot Bot commented Oct 8, 2017

Copy link
Copy Markdown

Hi there @mhvk 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labelled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

Everything looks good from my point of view! 👍

If there are any issues with this message, please report them here

;; Don't use TABS for indentations.
(setq-default indent-tabs-mode nil)

Maximum number of characters in a line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole setting has no effect, since python-mode ignores this for all but docstrings. Personally, I think one is better off not enabling it.

;; Show column number in the mode line.
(column-number-mode 1)

Syntax highlighting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is turned on by default, and the command given actually turns it off.

(add-hook 'text-mode-hook 'turn-on-auto-fill)

;; Show line number in the mode line.
(line-number-mode 1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is turned on by default, so no need to give it.

(line-number-mode 1)

;; Show column number in the mode line.
(column-number-mode 1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem particularly useful, so maybe just let people find out?


.. code-block:: scheme

(load-library "python")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole piece is not needed; this just replicates defaults.

(set-variable 'py-indent-offset 4)
(set-variable 'indent-tabs-mode nil))))

Highlight the column where a line must stop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this mostly as it seemed only "nice to have" rather than "recommended".

Delete trailing white spaces and blank lines
============================================

To manually delete trailing whitespaces, press ``C-t C-w``, which will run

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems crazy to me to bind this to a key when doing it on safe is so much easier. Also, why bind to a key that already does something like C-t (transpose).

saved, and hence all trailing whitespaces will be deleted on saving a Python
file.

To make sure that all "words" are separated by only one space, type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works for space between two words that the cursor is on. More work to remember the key combination than to just do it...

``M-SPC`` (use the ALT key since ``M-SPC`` sometimes brings up a context
menu.).

To collapse a set of blank lines to one blank line, place the cursor on one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar, just a trick, not something truly recommended.

@mhvk

mhvk commented Oct 8, 2017

Copy link
Copy Markdown
Contributor Author

astrobot reminded me about the change log: would it make sense to include a mention that we updated the recommendations?

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to simplifying.

Not sure if it is worth mentioning, but if you use different Python versions in different conda environments, you need to install flake8 for each env. For example, flake8 installed in Python 3.5 env will not recognize the f-string formatting in Python 3.6, causing false alarm.

Emacs setup for following coding guidelines
*******************************************

.. _flymake: http://www.emacswiki.org/emacs/FlyMake

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to retain a mention to use flymake instead of flycheck for Emacs 23 and older? Do people use Emacs that old?

@pllim

pllim commented Oct 9, 2017

Copy link
Copy Markdown
Member

Re: change log -- Doesn't hurt? (Although I realized I also added the "no change log required" label, so feel free to use your judgement.)

@mhvk

mhvk commented Oct 9, 2017

Copy link
Copy Markdown
Contributor Author

My own sense is to keep this simple - the idea mostly is to point people in the right direction; generally, this should be all that's needed, and, if not, the different web sites have more detail.

I added a changelog entry - doesn't hurt!

@mhvk

mhvk commented Oct 9, 2017

Copy link
Copy Markdown
Contributor Author

Also, probably no reason not to backport - changed the milestone accordingly.

@mhvk mhvk modified the milestones: v3.0.0, v2.0.3 Oct 9, 2017
@pllim

pllim commented Oct 9, 2017

Copy link
Copy Markdown
Member

"Changelog entry section (v3.0) inconsistent with milestone (v2.0.3)" -- bot

@mhvk mhvk modified the milestones: v2.0.3, v3.0.0 Oct 13, 2017
@mhvk mhvk modified the milestones: v3.0.0, v2.0.3 Oct 13, 2017
@mhvk

mhvk commented Oct 13, 2017

Copy link
Copy Markdown
Contributor Author

@pllim - you're right, the changes were mentioned for the wrong branch. But if I mention them in 2.0.3, it will not be seen by anyone reading the 3.0 release notes... So, instead, I left it as is but added manual backport to move the changelog entry to 2.0.3 section upon backport. @bsipocz - does this make any sense?

@bsipocz

bsipocz commented Oct 13, 2017

Copy link
Copy Markdown
Member

@mhvk - I'm not sure if I follow, if we backport then the changelog is moved, not copied over. Would you think anyone would check on this docs though based on reading the changelog?

@mhvk

mhvk commented Oct 13, 2017

Copy link
Copy Markdown
Contributor Author

@bsipocz - my logic for even including a changelog was that for a major version people might actually read the changelog (this is based on generalizing from myself, I fear ;-); but for a minor bug-fix version surely no-one reads the change-log, so I didn't want to put it in the 2.0.3 section.

@bsipocz

bsipocz commented Oct 13, 2017

Copy link
Copy Markdown
Member

Then I would just leave it in 3.0. That release will be out in a few months, and anyone wanting to set up their dev environment should really consult the latest docs not LTS.

@bsipocz bsipocz modified the milestones: v2.0.3, v3.0.0 Oct 13, 2017
@bsipocz

bsipocz commented Oct 13, 2017

Copy link
Copy Markdown
Member

Other than that, is it ready to be merged? I'm still stuck with the old emacs, but whenever get to the point of upgrading, this will be super useful. Thank you @mhvk!

@mhvk

mhvk commented Oct 13, 2017

Copy link
Copy Markdown
Contributor Author

@pllim - are you happy with the current version?

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pllim pllim merged commit 7ef7dff into astropy:master Oct 14, 2017
@mhvk mhvk deleted the emacs-guide-update branch October 14, 2017 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: Add flycheck to complement flymake section?

3 participants