-
Notifications
You must be signed in to change notification settings - Fork 7
Standalone refactor #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wynro
wants to merge
14
commits into
dotemacs:master
Choose a base branch
from
wynro:pr/standalone-refactor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Also added a macro to simplify writing functions that interact with the user
- Reverse function not added, ass the ip/cidr cannot be calculate from the network alone (for example, 10.1.1.1/8 would produce 10.0.0.0, but from the 10.0.0.0 we can't obtain the initial value)
- We have to include a couple of special cases for /31 and /32 networks. Technically speaking, both of those networks have 0 hosts, so there is no concept of first or last host in those. We have to settle to a couple of default values that look consistent with the old functions, and with a couple of IPv4 calculators I found on the Internet.
- When a function that used ipcalc-insert-or-return-value was called inside another function that did the same, both would receive the same current-prefix-arg, meaning that when called with universal argument both would write its output. Now, the outer most function captures the value of current-prefix-arg, and does not pass it to the internal function, preventing that behavior
…list - Now the full report can be generated and consumed programmatically
- With this, we can separate the logic of generating the information from the logic of formatting the information to present to the user. - We could (should) write extra tests for ipcalc-alist, but we are testing ipcalc, that uses it, so I'll consider it enough
- Instead of manually managing the value of current-prefix-arg, we can simply use `interactive-p' to check if the function was called interactively
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mainly, moved a lot of the functionality that was previously inside he the
ipcalcfunction to a bunch of separated functions, to allow independent usage, and (I think) cleaner code.Also added the functionality to insert the report in the current buffer using the universal argument (Now, by doing
C-u M-x ipcalc RET 192.168.25.0/24 RETthe full report is inserted on the current point).I have also added a bunch of tests to ensure that I didn't break anything during the refactoring.
There are still a couple of rough edges (for example, if you try to calculate the min/max host of a very small network, like a /31 or /32, it gives nonsensical answer), but I think this is good enough
You commented about bumping up the version. If you don't mind, I would prefer you to review this and then bump the version once we agree this is prepared to be merged.