Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Clean up zombie project for project.el #363

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

Merged
merged 14 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- uses: conao3/setup-cask@master
with:
version: 0.8.4
version: 'snapshot'

- name: Run tests
run:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:

- uses: conao3/setup-cask@master
with:
version: 0.8.4
version: 'snapshot'

- name: Run tests
run:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* Add capability to custom align agenda widget (#350)
* Correct straight.el package count (#354)
* Lazy load modules specify in dashboard buffer (#359)
* Clean up zombie project for project.el (#363)

## 1.7.0
> Released Feb 21, 2020
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ compile:
@echo "Compiling..."
@$(CASK) $(EMACS) -Q --batch \
-L . \
--eval '(setq byte-compile-error-on-warn t)' \
--eval '(setq byte-compile-error-on-warn nil)' \
-f batch-byte-compile $(ELS)
78 changes: 44 additions & 34 deletions dashboard-widgets.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
(declare-function projectile-relevant-known-projects "ext:projectile.el")
;;; project.el in Emacs 26 does not contain this function
(declare-function project-known-project-roots "ext:project.el" nil t)
(declare-function project-forget-zombie-projects "ext:project.el" nil t)
(declare-function org-agenda-format-item "ext:org-agenda.el")
(declare-function org-compile-prefix-format "ext:org-agenda.el")
(declare-function org-entry-is-done-p "ext:org.el")
Expand Down Expand Up @@ -198,11 +199,10 @@ Example:

(defcustom dashboard-startup-banner 'official
"Specify the startup banner.
Default value is `official', it displays
the Emacs logo. `logo' displays Emacs alternative logo.
An integer value is the index of text
banner. A string value must be a path to a .PNG or .TXT file.
If the value is nil then no banner is displayed."
Default value is `official', it displays the Emacs logo. `logo' displays Emacs
alternative logo. An integer value is the index of text banner. A string
value must be a path to a .PNG or .TXT file. If the value is nil then no banner
is displayed."
:type '(choice (const :tag "offical" official)
(const :tag "logo" logo)
(string :tag "a png or txt path"))
Expand Down Expand Up @@ -257,20 +257,16 @@ If nil it is disabled. Possible values for list-type are:
(agenda . "a")
(registers . "e"))
"Association list of items and their corresponding shortcuts.
Will be of the form `(list-type . keys)' as understood by
`(kbd keys)'. If nil, shortcuts are disabled. If an entry's
value is nil, that item's shortcut is disbaled. See
`dashboard-items' for possible values of list-type.'"
Will be of the form `(list-type . keys)' as understood by `(kbd keys)'.
If nil, shortcuts are disabled. If an entry's value is nil, that item's
shortcut is disbaled. See `dashboard-items' for possible values of list-type.'"
:type '(repeat (alist :key-type symbol :value-type string))
:group 'dashboard)

(defcustom dashboard-item-names nil
"Association list of item heading names.
When an item is nil or not present, the default name is used.
Will be of the form `(default-name . new-name)'.
Possible values for default-name are:
\"Recent Files:\" \"Bookmarks:\" \"Agenda for today:\",
\"Agenda for the coming week:\" \"Registers:\" \"Projects:\"."
Will be of the form `(default-name . new-name)'."
:type '(alist :key-type string :value-type string)
:options '("Recent Files:" "Bookmarks:" "Agenda for today:"
"Agenda for the coming week:" "Registers:" "Projects:")
Expand Down Expand Up @@ -357,11 +353,25 @@ If nil it is disabled. Possible values for list-type are:
:group 'dashboard)

(define-obsolete-face-alias
'dashboard-text-banner-face 'dashboard-text-banner "1.2.6")
'dashboard-text-banner-face 'dashboard-text-banner "1.2.6")
(define-obsolete-face-alias
'dashboard-banner-logo-title-face 'dashboard-banner-logo-title "1.2.6")
'dashboard-banner-logo-title-face 'dashboard-banner-logo-title "1.2.6")
(define-obsolete-face-alias
'dashboard-heading-face 'dashboard-heading "1.2.6")
'dashboard-heading-face 'dashboard-heading "1.2.6")

;;
;; Util
;;
(defmacro dashboard-mute-apply (&rest body)
"Execute BODY without message."
(declare (indent 0) (debug t))
`(let (message-log-max)
(with-temp-message (or (current-message) nil)
(let ((inhibit-message t)) ,@body))))

(defun dashboard-funcall-fboundp (fnc &rest args)
"Call FNC with ARGS if exists."
(when (fboundp fnc) (if args (funcall fnc args) (funcall fnc))))

;;
;; Generic widget helpers
Expand Down Expand Up @@ -643,7 +653,8 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."
;; Section list
;;
(defmacro dashboard-insert-section-list (section-name list action &rest rest)
"Insert into SECTION-NAME a LIST of items, expanding ACTION and passing REST to widget creation."
"Insert into SECTION-NAME a LIST of items, expanding ACTION and passing REST
to widget creation."
`(when (car ,list)
(mapc
(lambda (el)
Expand Down Expand Up @@ -685,14 +696,13 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."

(defun dashboard-insert-footer ()
"Insert footer of dashboard."
(let ((footer (and dashboard-set-footer (dashboard-random-footer))))
(when footer
(insert "\n")
(dashboard-center-line footer)
(insert dashboard-footer-icon)
(insert " ")
(insert (propertize footer 'face 'dashboard-footer))
(insert "\n"))))
(when-let ((footer (and dashboard-set-footer (dashboard-random-footer))))
(insert "\n")
(dashboard-center-line footer)
(insert dashboard-footer-icon)
(insert " ")
(insert (propertize footer 'face 'dashboard-footer))
(insert "\n")))

;;
;; Truncate
Expand Down Expand Up @@ -863,7 +873,7 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."
"Add the list of LIST-SIZE items from recently edited files."
(setq dashboard--recentf-cache-item-format nil)
(recentf-mode)
(let ((inhibit-message t) message-log-max) (recentf-cleanup))
(dashboard-mute-apply (recentf-cleanup))
(dashboard-insert-section
"Recent Files:"
(dashboard-shorten-paths recentf-list 'dashboard-recentf-alist 'recents)
Expand Down Expand Up @@ -936,9 +946,8 @@ WIDGET-PARAMS are passed to the \"widget-create\" function."
(defcustom dashboard-projects-switch-function
nil
"Custom function to switch to projects from dashboard.
If non-NIL, should be bound to a function with one argument. The
function will be called with the root directory of the project to
switch to."
If non-NIL, should be bound to a function with one argument. The function will
be called with the root directory of the project to switch to."
:type '(choice (const :tag "Default" nil) function)
:group 'dashboard)

Expand Down Expand Up @@ -995,11 +1004,11 @@ Return function that returns a list of projects."
(cl-case dashboard-projects-backend
(`projectile
(require 'projectile)
(let ((inhibit-message t) message-log-max)
(projectile-cleanup-known-projects))
(dashboard-mute-apply (projectile-cleanup-known-projects))
(projectile-load-known-projects))
(`project-el
(require 'project)
(dashboard-mute-apply (dashboard-funcall-fboundp #'project-forget-zombie-projects))
(project-known-project-roots))
(t
(display-warning '(dashboard)
Expand Down Expand Up @@ -1116,8 +1125,8 @@ When the dashboard-agenda is created this format is inserted into

(defun dashboard-filter-agenda-by-time ()
"Include entry if it has a scheduled-time or deadline-time in the future.
An entry is included if this function returns nil and excluded
if returns a point."
An entry is included if this function returns nil and excluded if returns a
point."
(let ((scheduled-time (org-get-scheduled-time (point)))
(deadline-time (org-get-deadline-time (point)))
(due-date (dashboard-due-date-for-agenda)))
Expand Down Expand Up @@ -1208,7 +1217,8 @@ found for the strategy it uses nil predicate."

(defun dashboard-agenda--compare-entries (entry1 entry2 strategies predicate attribute)
"Compare `ENTRY1' and `ENTRY2' by `ATTRIBUTE' using `PREDICATE'.
If both attributes are nil or equals the next strategy in `STRATEGIES' is used to compare."
If both attributes are nil or equals the next strategy in `STRATEGIES' is used
to compare."
(let ((arg1 (alist-get attribute (nth 3 entry1)))
(arg2 (alist-get attribute (nth 3 entry2))))
(cond
Expand Down
16 changes: 7 additions & 9 deletions dashboard.el
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,11 @@ Optional prefix ARG says how many lines to move; default is one line."
(origial-recentf-list recentf-list)
(dashboard-num-recents (or (cdr (assoc 'recents dashboard-items)) 0))
(max-line-length 0))
;; disable recentf mode,
;; so we don't flood the recent files list with org mode files
;; do this by making a copy of the part of the list we'll use
;; let dashboard widgets change that
;; then restore the orginal list afterwards
;; (this avoids many saves/loads that would result from
;; disabling/enabling recentf-mode)
;; disable recentf mode, so we don't flood the recent files list with org
;; mode files do this by making a copy of the part of the list we'll use
;; let dashboard widgets change that then restore the orginal list afterwards
;; (this avoids many saves/loads that would result from disabling/enabling
;; recentf-mode)
(when recentf-is-on
(setq recentf-list (dashboard-subseq recentf-list dashboard-num-recents)))
(when (or dashboard-force-refresh
Expand Down Expand Up @@ -249,8 +247,8 @@ Optional prefix ARG says how many lines to move; default is one line."
;;;###autoload
(defun dashboard-setup-startup-hook ()
"Setup post initialization hooks.
If a command line argument is provided,
assume a filename and skip displaying Dashboard."
If a command line argument is provided, assume a filename and skip displaying
Dashboard."
(when (< (length command-line-args) 2)
(add-hook 'after-init-hook (lambda ()
;; Display useful lists of items
Expand Down