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

0.8.2 #408

Merged
merged 3 commits into from
May 8, 2020
Merged

0.8.2 #408

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ package: clean pkg-el
info:
${CASK} info

install-package-from-melpa:
./install-package-from.sh melpa

install-file-with-deps-from-melpa: package
./install-file-with-deps-from.sh melpa $(VERSION)

release:
./release.sh $(VERSION) $(PACKAGE)

Expand Down
10 changes: 9 additions & 1 deletion TODO.org
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
- [ ] #245 - Trying to sync a card: orgtrello-buffer/compute-marker: Wrong type argument: numberp, nil
- [ ] #248 - Installing from melpa (unstable) works, but then it errs on an undefined variable "error-messages"
- [ ] #263 - Colors broken in org trello
* IN-PROGRESS 0.8.1 [100%]

* DONE 0.8.2 [100%]
CLOSED: [2020-05-08 Fri 18:57]
- [X] #406: Deactivate org-indent-mode alongside org-trello minor mode
- [X] #407: Improve card formatting step
- [X] Clean up no longer used scripts

* DONE 0.8.1 [100%]
CLOSED: [2020-05-08 Fri 18:09]
- [X] Make adding trello colors to `org-tag-alist` optional - Close #365
- [X] Fix typo in link to issue tracker - Close #364
- [X] Fix ci
Expand Down
22 changes: 0 additions & 22 deletions install-file-with-deps-from.sh

This file was deleted.

18 changes: 0 additions & 18 deletions install-package-from.sh

This file was deleted.

39 changes: 21 additions & 18 deletions org-trello-buffer.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; org-trello-buffer.el --- Manipulation functions of org-trello buffer

;; Copyright (C) 2015-2017 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Copyright (C) 2015-2020 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>

;; Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Keywords:
Expand Down Expand Up @@ -577,28 +577,31 @@ If yes, indent such region with INDENT space."
(unless (<= indent (org-get-indentation));; if need be
(indent-rigidly start end indent))))));; indent rightfully

(defun orgtrello-buffer-indent-card-descriptions ()
"Indent the buffer's card descriptions rigidly starting at 2.
(defun orgtrello-buffer-indent-card-description ()
"Indent a card description rigidly 2 spaces from beginning of line."
(save-excursion
(orgtrello-entity-back-to-card)
(orgtrello-buffer-indent-region
org-trello-buffer--indent-description
(orgtrello-entity-card-metadata-region))))

(defun orgtrello-buffer-indent-all-card-descriptions ()
"Indent buffer's card descriptions rigidly 2 spaces from beginning of line.
Function to be triggered by `before-save-hook` on org-trello-mode buffer."
(when (orgtrello-setup-org-trello-on-p)
(orgtrello-buffer-org-map-entries
(lambda ()
(-when-let (card-description
(-> (orgtrello-buffer-entry-get-full-metadata)
orgtrello-data-current
orgtrello-data-entity-description))
(orgtrello-buffer-indent-region
org-trello-buffer--indent-description
(orgtrello-entity-card-metadata-region)))))))
'orgtrello-buffer-indent-card-description)))

(defun orgtrello-buffer-indent-card-data ()
"Indent the card data rigidly starting at 2.
"Indent a card rigidly 2 spaces from beginning of line."
(orgtrello-buffer-indent-region org-trello--checklist-indent
(orgtrello-entity-card-data-region)))

(defun orgtrello-buffer-indent-all-card-data ()
"Indent the card data rigidly 2 spaces from beginning of line.
Function to be triggered by `before-save-hook` on org-trello-mode buffer."
(when (orgtrello-setup-org-trello-on-p)
(orgtrello-buffer-org-map-entries
(lambda ()
(orgtrello-buffer-indent-region org-trello--checklist-indent
(orgtrello-entity-card-data-region))))))
(orgtrello-buffer-org-map-entries 'orgtrello-buffer-indent-card-data)))

(defalias 'orgtrello-buffer-org-entity-metadata 'org-heading-components
"Compute the basic org-mode metadata.")
Expand Down Expand Up @@ -776,8 +779,8 @@ For a checkbox, move to the 1- point (because of overlays)."
"If on org-trello checkbox move to the org end of the line.
Trigger the needed indentation for the card's description and data.
In any case, execute ORG-FN."
(orgtrello-buffer-indent-card-descriptions)
(orgtrello-buffer-indent-card-data)
(orgtrello-buffer-indent-all-card-descriptions)
(orgtrello-buffer-indent-all-card-data)
(when (orgtrello-entity-org-checkbox-p)
(org-end-of-line))
(funcall org-fn))
Expand Down
15 changes: 11 additions & 4 deletions org-trello-controller.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; org-trello-controller.el --- Controller of org-trello mode

;; Copyright (C) 2015-2017 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Copyright (C) 2015-2020 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>

;; Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Keywords:
Expand Down Expand Up @@ -261,12 +261,19 @@ BUFFER-NAME to specify the buffer with which we currently work."
(orgtrello-data-put-entity-id marker current)
(eval (orgtrello-proxy-delete-entity current)))))

(defun orgtrello-controller--indent-card (entity)
"Indent properly the card information (whatever the ENTITY is)."
(orgtrello-buffer-indent-card-description)
(orgtrello-buffer-indent-card-data)
:ok)

(defun orgtrello-controller-checks-then-sync-card-to-trello ()
"Check then do the actual sync if everything is ok."
(orgtrello-action-functional-controls-then-do
'(orgtrello-controller--on-entity-p
orgtrello-controller--right-level-p
orgtrello-controller--mandatory-name-ok-p)
orgtrello-controller--mandatory-name-ok-p
orgtrello-controller--indent-card)
(orgtrello-buffer-safe-entry-full-metadata)
'orgtrello-controller-sync-card-to-trello
(current-buffer)))
Expand Down Expand Up @@ -1431,8 +1438,8 @@ Returns to BUFFER-NAME at POINT when done."
"Prepare the buffer to receive org-trello data."
(when (orgtrello-setup-org-trello-on-p)
(orgtrello-buffer-install-overlays)
(orgtrello-buffer-indent-card-descriptions)
(orgtrello-buffer-indent-card-data)))
(orgtrello-buffer-indent-all-card-descriptions)
(orgtrello-buffer-indent-all-card-data)))

(defun orgtrello-controller-mode-on-hook-fn ()
"Start org-trello hook function to install some org-trello setup."
Expand Down
50 changes: 28 additions & 22 deletions org-trello-entity.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; org-trello-entity.el --- Predicates to determine if we are currently on a card/checklist/item + some default movments

;; Copyright (C) 2015-2017 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Copyright (C) 2015-2020 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>

;; Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Keywords:
Expand Down Expand Up @@ -113,10 +113,12 @@ If hitting a heading or the end of the file, return nil."
(defun orgtrello-entity-card-metadata-end-point ()
"Compute the card's metadata end point.
This corresponds to the card's first checkbox position."
(save-excursion
(orgtrello-entity-back-to-card)
(orgtrello-entity-goto-end-card-metadata)
(1- (point))))
(save-restriction
(apply 'narrow-to-region (orgtrello-entity-card-region))
(save-excursion
(orgtrello-entity-back-to-card)
(orgtrello-entity-goto-end-card-metadata)
(1- (point)))))

(defun orgtrello-entity-card-at-pt ()
"Determine if currently on the card region."
Expand All @@ -134,10 +136,12 @@ This corresponds to the card's first checkbox position."

(defun orgtrello-entity-card-description-start-point ()
"Compute the first character of the card's description content."
(save-excursion
(orgtrello-entity-back-to-card)
(search-forward ":END:" nil t) ;; if not found, return nil & do not move pt
(1+ (point-at-eol))))
(save-restriction
(apply 'narrow-to-region (orgtrello-entity-card-region))
(save-excursion
(orgtrello-entity-back-to-card)
(search-forward ":END:" nil t) ;; if not found, return nil & do not move pt
(1+ (point-at-eol)))))
;; in any case, the description is then just 1 point
;; more than the current position

Expand All @@ -151,19 +155,21 @@ This corresponds to the card's first checkbox position."
"Compute the card's first comment position.
Does preserve position.
If no comment is found, return the card's end region."
(save-excursion
(orgtrello-entity-back-to-card)
(let ((card-region (orgtrello-entity-card-region)))
(apply 'narrow-to-region card-region)
(let ((next-pt (-if-let (next-pt
(search-forward-regexp "\\*\\* COMMENT " nil t))
;; if not found, return nil and do not move point
(save-excursion
(goto-char next-pt)
(point-at-bol))
(orgtrello-entity-card-end-point))))
(widen)
next-pt))))
(save-restriction
(apply 'narrow-to-region (orgtrello-entity-card-region))
(save-excursion
(orgtrello-entity-back-to-card)
(let ((card-region (orgtrello-entity-card-region)))
(apply 'narrow-to-region card-region)
(let ((next-pt (-if-let (next-pt
(search-forward-regexp "\\*\\* COMMENT " nil t))
;; if not found, return nil and do not move point
(save-excursion
(goto-char next-pt)
(point-at-bol))
(orgtrello-entity-card-end-point))))
(widen)
next-pt)))))

(defun orgtrello-entity-compute-checklist-header-region ()
"Compute the checklist's region.
Expand Down
8 changes: 7 additions & 1 deletion org-trello.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; org-trello.el --- Minor mode to synchronize org-mode buffer and trello board

;; Copyright (C) 2013-2017 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Copyright (C) 2013-2020 Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>

;; Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
;; Maintainer: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
Expand Down Expand Up @@ -562,6 +562,12 @@ opens new issue in org-trello's github tracker."
org-trello-current-prefix-keybinding)))
'do-append)

(add-hook 'org-trello-mode-on-hook
(lambda ()
;; deactivate org-indent-mode if activated
(when (and (boundp 'org-indent-mode) org-indent-mode)
(org-indent-mode -1))))

(defvar org-trello-mode-off-hook)
(setq org-trello-mode-off-hook nil) ;; for dev
(add-hook 'org-trello-mode-off-hook 'orgtrello-controller-mode-off-hook-fn)
Expand Down
2 changes: 0 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ git tag -a -s $VERSION
git push upstream --tag

make package

./upload-to-marmalade.sh $VERSION $PACKAGE
15 changes: 0 additions & 15 deletions run-tests.sh

This file was deleted.

35 changes: 24 additions & 11 deletions test/org-trello-buffer-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
(ert-deftest test-orgtrello-buffer-org-decorator ()
(should (eq :done
(with-mock
(mock (orgtrello-buffer-indent-card-descriptions) => :indent-card-desc-done)
(mock (orgtrello-buffer-indent-card-data) => :indent-card-data-done)
(mock (orgtrello-buffer-indent-all-card-descriptions) => :indent-card-desc-done)
(mock (orgtrello-buffer-indent-all-card-data) => :indent-card-data-done)
(mock (orgtrello-entity-org-checkbox-p) => nil)
(orgtrello-buffer-org-decorator (lambda () :done)))))
(should (eq :done
(with-mock
(mock (orgtrello-buffer-indent-card-descriptions) => :indent-card-desc-done)
(mock (orgtrello-buffer-indent-card-data) => :indent-card-data-done)
(mock (orgtrello-buffer-indent-all-card-descriptions) => :indent-card-desc-done)
(mock (orgtrello-buffer-indent-all-card-data) => :indent-card-data-done)
(mock (orgtrello-entity-org-checkbox-p) => t)
(mock (org-end-of-line) => :end-of-line-done)
(orgtrello-buffer-org-decorator (lambda () :done))))))
Expand Down Expand Up @@ -223,7 +223,7 @@
:orgtrello-checksum: checksum
:unknown: something
:END
description here
description here
"
(orgtrello-buffer-org-entity-metadata)))))

Expand Down Expand Up @@ -856,7 +856,20 @@ on all string"
so the second one won't be"
(orgtrello-buffer-indent-region 2 `(,(point-min) ,(point-max)))))))

(ert-deftest test-orgtrello-buffer-indent-card-descriptions ()
(ert-deftest test-orgtrello-buffer-indent-card-description ()
(should (string=
"* card
description will be indented
after function call.
"
(orgtrello-tests-with-temp-buffer-and-return-buffer-content
"* card
description will be indented
after function call.
"
(orgtrello-buffer-indent-card-description)))))

(ert-deftest test-orgtrello-buffer-indent-all-card-descriptions ()
(should (string=
"* card
description not indented
Expand All @@ -871,7 +884,7 @@ but this will be after function call.
* card 2
another description which will be indented
"
(orgtrello-buffer-indent-card-descriptions))))
(orgtrello-buffer-indent-all-card-descriptions))))
;; not indented
(should (string=
"* card
Expand All @@ -888,7 +901,7 @@ but this will be after function call.
another description which will be indented
"
(let ((org-trello--mode-activated-p))
(orgtrello-buffer-indent-card-descriptions))))))
(orgtrello-buffer-indent-all-card-descriptions))))))

(ert-deftest test-orgtrello-buffer-get-usernames-assigned-property ()
(should (string= "user1,user2,user3"
Expand Down Expand Up @@ -964,7 +977,7 @@ another description which will be indented
"
(orgtrello-buffer-extract-identifier (point-min))))))

(ert-deftest test-orgtrello-buffer-indent-card-data ()
(ert-deftest test-orgtrello-buffer-indent-all-card-data ()
;; indentation
(should (string= "* card0
- [ ] check1
Expand All @@ -975,7 +988,7 @@ another description which will be indented
- [ ] check1
- [ ] item1
"
(orgtrello-buffer-indent-card-data))))
(orgtrello-buffer-indent-all-card-data))))
;; not indented because no org-trello activated
(should (string= "* card0
- [ ] check1
Expand All @@ -987,7 +1000,7 @@ another description which will be indented
- [ ] item1
"
(let (org-trello--mode-activated-p)
(orgtrello-buffer-indent-card-data))))))
(orgtrello-buffer-indent-all-card-data))))))

(ert-deftest test-orgtrello-buffer--extract-metadata ()
(should (equal '(1 1 nil nil "card" nil)
Expand Down