Skip to content

Conversation

@shipmints
Copy link

…Added a main menu-bar menu with all major commands.

No option to suppress the menu.

No work done on custom faces for the mode line.

No option to customize the mode-line appearance.

No work done on a context menu (not sure it's needed).

…Added a main menu-bar menu with all major commands.

No option to suppress the menu.

No work done on custom faces for the mode line.

No option to customize the mode-line appearance.

No work done on a context menu (not sure it's needed).
@alphapapa
Copy link
Owner

I appreciate your wanting to contribute substantially to this package. I don't recall having discussed copyright assignment yet, though. https://github.com/alphapapa/activities.el#copyright-assignment Have you done that?

@shipmints
Copy link
Author

Yes.

@alphapapa
Copy link
Owner

Very well, but I am not allowed to take your word for it. The Emacs maintainers require me to verify by checking with them. What name and email address should I ask them about?

@alphapapa
Copy link
Owner

Yes.

I happened to just notice this post on emacs-devel by you: https://lists.gnu.org/archive/html/emacs-devel/2024-06/msg00691.html You have asked to begin the process, but you have not completed it, and I cannot accept your contributions until the process has been completed, and until I receive confirmation from the FSF secretary or the Emacs maintainers.

@shipmints
Copy link
Author

Perfect. How will you get that confirmation or should I copy/paste their response to me?

@alphapapa
Copy link
Owner

When you send the form to the FSF, you can ask them to cc me on the confirmation. Otherwise, you can tell me that the process is completed, and then I can ask the maintainers to confirm.

@shipmints
Copy link
Author

I've asked them to cc you and pasted your email address. Either way, I'll let you know. Thank you for your patience.

Copy link
Owner

@alphapapa alphapapa left a comment

Choose a reason for hiding this comment

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

Thanks.

Comment on lines +482 to +483
(defvar activities-mode-map (make-sparse-keymap)
"The mode keymap for `activities-mode'.")
Copy link
Owner

Choose a reason for hiding this comment

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

Strictly speaking, I'm not sure if this is necessary, or actually correct, because it's not necessary to use activities-mode to use the various commands, so I'm not sure if the menu bar entries should be tied to a mode/map.

Copy link
Author

Choose a reason for hiding this comment

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

We need the mode's keymap for the menu to appear on the menu bar. If the mode isn't active, the menu won't appear so no harm. It doesn't affect general operation.

Comment on lines 485 to 507
(defun activities-mode-line-format ()
(when-let ((cur (activities-current)))
(let ((cur-activity-title (concat " " (activities-name-for cur))))
`(:propertize
,cur-activity-title
mouse-face mode-line-highlight
help-echo
,(lambda (&rest _)
(concat
(format "Current activity:%s\n" cur-activity-title)
"mouse-1: Display minor mode menu\n"
"mouse-2: Show help for minor mode"))
keymap
,(let ((map (make-sparse-keymap)))
(define-key map [mode-line down-mouse-1]
activities-mode-line-menu)
(define-key map [mode-line down-mouse-3]
activities-mode-line-menu)
(define-key map [mode-line mouse-2]
(lambda ()
(interactive)
(describe-function 'activities-mode)))
map)))))
Copy link
Owner

Choose a reason for hiding this comment

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

  1. Nitpick, but I prefer not to abbreviate variable names in most cases, e.g. cur.
  2. Probably the keymap should be defined statically.
  3. I guess the lambda could be defined statically as well, i.e. not be a closure over the title variable, because it should be able to get the current activity name by doing what this function does when necessary.
  4. The function should have a docstring. :)

Copy link
Author

Choose a reason for hiding this comment

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

Done. I left the closure and keymap as is since that seems to be the general approach via informal surveillance (and it works fine and without any overall performance issues).

activities.el Outdated
Comment on lines 509 to 513
(defcustom activities-mode-line '(:eval (activities-mode-line-format))
"Activities mode line definition."
:type 'sexp
:group 'activities
:risky t)
Copy link
Owner

Choose a reason for hiding this comment

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

  1. I think this should be called activities-mode-lighter, unless I'm missing something.
  2. It shouldn't be necessary to specify the group, since it comes after the defcustom earlier in the file, right?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

:global t
:group 'activities
:lighter activities-mode-line
:keymap activities-mode-map
Copy link
Owner

Choose a reason for hiding this comment

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

See earlier comment about menu bar and mode map.

Alternatively, we could consider defining this map as a prefix map for the suggested bindings.

Copy link
Author

Choose a reason for hiding this comment

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

Let's address prefix map and suggested bindings separately.

(setf activities-mode-timer nil))
(remove-hook 'kill-emacs-hook #'activities-mode--killing-emacs)))

(require 'easymenu)
Copy link
Owner

Choose a reason for hiding this comment

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

It would be good to add a header comment for this section.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

activities.el Outdated
Comment on lines 535 to 548
(setq activities-menu-item-resume
'("Resume..."
:help "Resume an existing activity"
:filter (lambda (&optional _)
(let ((current-activity-name
(when-let ((current-activity (activities-current)))
(activities-activity-name current-activity))))
(mapcar (lambda (act)
(vector act `(activities-resume (activities-named ,act))
:style 'radio
:selected (equal current-activity-name act)
))
(activities-names))))
))
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure what this is about, but a bare setq on an undefined variable is bogus, and there are hanging parens. :)

Copy link
Author

Choose a reason for hiding this comment

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

Done. Now a defvar.

activities.el Outdated
Comment on lines 550 to 578
(easy-menu-define activities-menu activities-mode-map
"Activities Menu"
`("Activities" :visible activities-mode
["New" activities-new
:help "Create a new, empty activity"]
["Define" activities-define
:help "Create a new activity using the current frame/tab"]
["Resume" activities-resume
:help "Resume an existing activity"]
,activities-menu-item-resume
["Revert" activities-revert
:help "Revert the current activity to its original state"]
["Suspend" activities-suspend
:help "Suspend the specified live activity and save its current state"]
["Kill" activities-kill
:help "Revert and suspend the specified live activity"]
["Switch" activities-switch
:help "Focus on the specified live activity"]
["Switch Buffer" activities-switch-buffer
:help "Focus on the specified buffer from a live activity (activities-tabs-mode only)"]
["List" activities-list
:help "Show the master list of known activities"]
["Rename" activities-rename
:help "Rename the specified activity"]
["Discard" activities-discard
:help "Discard the specified activity (this is undoable)"]
["Save All" activities-save-all
:help "Save all live activities to disk"]
))
Copy link
Owner

Choose a reason for hiding this comment

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

It would be helpful to roughly organize these entries by purpose, with some separators between major types.

Also, hanging parens. :)

Copy link
Author

Choose a reason for hiding this comment

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

Done.

activities.el Outdated
"Activities Mode Line Menu"
`("Activities"
,activities-menu-item-resume
))
Copy link
Owner

Choose a reason for hiding this comment

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

Also, hanging parens. :)

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@alphapapa alphapapa self-assigned this Jul 13, 2024
@alphapapa alphapapa added the enhancement New feature or request label Jul 13, 2024
@alphapapa alphapapa added this to the v0.8 milestone Jul 13, 2024
@shipmints
Copy link
Author

FYI, I added a defensive test in the mode before setting the timer, should someone set activities-mode-idle-frequency to nil (as I might).

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.

2 participants