Skip to content
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

kotct/packup ui #84

Merged
merged 13 commits into from
Jun 21, 2018
Merged

kotct/packup ui #84

merged 13 commits into from
Jun 21, 2018

Conversation

samontea
Copy link
Contributor

implemented kotct/packup from #66

  • performed manual user testing.
  • does not include unit testing

@samontea samontea requested review from rye and cg505 August 24, 2017 16:29
@rye
Copy link
Member

rye commented Aug 24, 2017

This is a great start—thanks for your work so far on this, @samontea! 🎉 💯

Some off-hand notes from my initial evaluation, which aren't really criticisms of this work but more general ideas of where we can go from this:

  • After checking out and restarting Emacs, M-x kotct/packup fails with

    command-execute: Autoloading file /Users/kristofer/Git/kotct/dot/.emacs.d/lisp/package/packup.elc failed to define function kotct/packup
    

    when I switch branches, but this seems unrelated as deleting the .elc file for packup.el resolves this issue.

  • Can we add U and M to the help if they have been implemented? (It seems that they have been.)

  • When there are no updates to perform, can the packup buffer say something and not be blank? This could be a static idle thing defined in a variable.

  • I don't know how package-list from Emacs does column headers, but do we want to have column headers? Those are pretty cool. Also, can we separate the version with . rather than ? (Also, colors?)

  • After executing, a buffer pops up listing everything to be installed. As the installation process proceeds, this list buffer stays open while Emacs blocks for this installation. This is normal and probably part of the existing installation procedure. I'm wondering if we can do the heavy work in a way that doesn't bring that up or at least lets us customize. EDIT: I think this is part of the existing packup stuff, and has little to do with the UI.

  • Using this UI, obsolete packages are kept around—do we want to handle cleaning up for our users?

I will do an actual code review shortly, but again, this looks pretty awesome.

Copy link
Member

@rye rye left a comment

Choose a reason for hiding this comment

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

Very good, just a couple of tweaks to be made I think.

(defvar kotct/packup-marker-char ?x
"In Packup, the current mark character.
This is what the do-commands look for, and the flag the mark-commands store."
)
Copy link
Member

Choose a reason for hiding this comment

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

Move to previous line? I don't think we do this anywhere else.

Returns \"\" if there is no package name on the line."
(save-excursion
(beginning-of-line)
(let (p)
Copy link
Member

Choose a reason for hiding this comment

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

What is p? (Better name?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't feel like it's ambiguous, and i don't feel like it deserves a better name. it's just a variable that's like not used and assigned two lines below to be a point. ¯_(ツ)_/¯

Copy link
Member

Choose a reason for hiding this comment

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

Okay so like would point be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure w/e

(while next-position
(goto-char next-position)
(setq results (cons ,body results))
(message "hi")
Copy link
Member

Choose a reason for hiding this comment

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

Remove "hi"?


(defun kotct/packup-help ()
(interactive)
(message "g-refresh m-mark u-unmark x-execute ?-help"))
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're going to end up with a lot of commands bound. if we document everything in the help it's going to be insane. i think we should just let people run describe-bindings. this is the way that dired does things.

Copy link
Member

Choose a reason for hiding this comment

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

That works. Then bind ? to describe-bindings, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uhm no that would be confusing to a new user. i think that we should do what dired does. if a user wants the keybindings described they can just run C-h b. we might investigate creating a control panel style help/command dialogue like magit has, but that's future work.

Copy link
Member

Choose a reason for hiding this comment

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

How about adding U and M, besides? dired still has a short help, and these would not be out of the scope of our short help.

"Creates an interactive buffer to install/update packages."
(interactive)
(let ((old-buf (current-buffer))
(buffer (create-file-buffer "*packup*"))) ;; this is wrong...
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, buffer has name packup for me with no cool asterisks. We should figure out how. Here is list-packages from package.el in Emacs, which seems to use get-buffer-create instead.

;;;###autoload
(defun list-packages (&optional no-fetch)
  "Display a list of packages.
This first fetches the updated list of packages before
displaying, unless a prefix argument NO-FETCH is specified.
The list is displayed in a buffer named `*Packages*'."
  (interactive "P")
  (require 'finder-inf nil t)
  ;; Initialize the package system if necessary.
  (unless package--initialized
    (package-initialize t))
  ;; Integrate the package-menu with updating the archives.
  (add-hook 'package--post-download-archives-hook
            #'package-menu--post-refresh)
  (add-hook 'package--post-download-archives-hook
            #'package-menu--mark-or-notify-upgrades 'append)

  ;; Generate the Package Menu.
  (let ((buf (get-buffer-create "*Packages*")))
    (with-current-buffer buf
      (package-menu-mode)

      ;; Fetch the remote list of packages.
      (unless no-fetch (package-menu-refresh))

      ;; If we're not async, this would be redundant.
      (when package-menu-async
        (package-menu--generate nil t)))
    ;; The package menu buffer has keybindings.  If the user types
    ;; `M-x list-packages', that suggests it should become current.
    (switch-to-buffer buf)))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uhm you're straight tripping if you run M-x kotct/packup it creates a buffer that is called *packup*. i'm like sure of that

i used create-file-buffer because it was what dired uses. i agree i should have used get-buffer-create. pushing that up now.

Copy link
Member

Choose a reason for hiding this comment

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

On Emacs HEAD it doesn't have asterisks, then, or they aren't displayed properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

¯_(ツ)_/¯

@samontea
Copy link
Contributor Author

Re: points you brought up in your comment, but not your code review.

  • I added a message letting the user know if there are now packages to be updated.

  • We don't receive header information.

  • The popping up buffer issue is out of scope for this issue. File a separate issue describing how we can remove that buffer when we execute a kotct/packup update script.

  • Cleaning up packages for the users is out of scope of this issue, and the general update feature. That is something we can discuss in a separate issue

Copy link
Member

@rye rye left a comment

Choose a reason for hiding this comment

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

My only remaining problems are just a couple of leftovers from my previous review.

@@ -47,7 +229,8 @@ If UPDATE is non-nil, out-of-date packages will be updated."
(terpri)
(princ (symbol-name (car package)))
(princ (if (cdr package) " (update)" " (install)"))))
(if (y-or-n-p "Auto install/update these package?")
(if (or auto-update
(y-or-n-p "Auto install/update these package?"))
Copy link
Member

Choose a reason for hiding this comment

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

Auto install/update these package(s)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of existing code. Open an issue.

"Creates an interactive buffer to install/update packages."
(interactive)
(let ((old-buf (current-buffer))
(buffer (get-buffer-create "*packup*")))
Copy link
Member

Choose a reason for hiding this comment

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

screen shot 2017-08-25 at 10 31 27 am

screen shot 2017-08-25 at 10 32 06 am

I think the display problems are due to capitalization. Can this be capitalized?

Copy link
Member

Choose a reason for hiding this comment

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

Actually, never mind. It's not. It seems to be a problem with the mode.

Copy link
Member

@rye rye Aug 25, 2017

Choose a reason for hiding this comment

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

No, I revise this again. It's because you set mode-line-buffer-identification to packup that we get rid of the bolded name.

EDIT: Added additional review for this.


(defun kotct/packup-help ()
(interactive)
(message "g-refresh m-mark u-unmark x-execute ?-help"))
Copy link
Member

Choose a reason for hiding this comment

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

How about adding U and M, besides? dired still has a short help, and these would not be out of the scope of our short help.

(setq major-mode 'packup-mode
mode-name "Packup"
buffer-read-only t ;; read only
mode-line-buffer-identification "packup")
Copy link
Member

Choose a reason for hiding this comment

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

Can this be removed? I like the default buffer ID, and it's less confusing.

Copy link
Member

@rye rye left a comment

Choose a reason for hiding this comment

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

This looks good enough to me now.

@samontea samontea merged commit 4e01807 into master Jun 21, 2018
@samontea samontea deleted the packup-ui branch June 21, 2018 23:33
@cg505
Copy link
Contributor

cg505 commented Jun 22, 2018

yooooooooo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants