emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Question about updating a package for the org-get-tags change
@ 2018-04-23 16:02 Kaushal Modi
  2018-04-23 17:08 ` Kaushal Modi
  2018-04-23 18:11 ` Nicolas Goaziou
  0 siblings, 2 replies; 4+ messages in thread
From: Kaushal Modi @ 2018-04-23 16:02 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Hello,

I am trying to update the ox-hugo package to work with zero warnings for
both Org 9.1 and 9.2.

I tried adding this function:

(defsubst org-hugo--get-tags ()
  "Wrapper function to pick the correct fn for getting inherited Org tags."
  ;; Starting Org 9.2, `org-get-tags' returns all the inherited tags
  ;; instead of returning only the local tags i.e. only the current
  ;; headline tags.
  ;;
https://code.orgmode.org/bzg/org-mode/commit/fbe56f89f75a8979e0ba48001a822518df2c66fe
  ;; For Org <= 9.1, `org-get-tags' returned a list of tags *only* at
  ;; the current heading, while `org-get-tags-at' returned inherited
  ;; tags too.
  (if (fboundp #'org--get-local-tags)   ;If using Org 9.2+
      (org-get-tags)
    (org-get-tags-at)))

But ox-hugo still compiles with this warning with Org 9.2:

In org-hugo--get-tags:
ox-hugo.el:1371:6:Warning: ‘org-get-tags-at’ is an obsolete function (as of
    Org 9.2); use ‘org-get-tags’ instead.

What's the canonical way to deal with such cases?

Thanks.

Kaushal

-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1526 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about updating a package for the org-get-tags change
  2018-04-23 16:02 Question about updating a package for the org-get-tags change Kaushal Modi
@ 2018-04-23 17:08 ` Kaushal Modi
  2018-04-23 18:11 ` Nicolas Goaziou
  1 sibling, 0 replies; 4+ messages in thread
From: Kaushal Modi @ 2018-04-23 17:08 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]

On Mon, Apr 23, 2018 at 12:02 PM Kaushal Modi <kaushal.modi@gmail.com>
wrote:

> But ox-hugo still compiles with this warning with Org 9.2:
>
> In org-hugo--get-tags:
> ox-hugo.el:1371:6:Warning: ‘org-get-tags-at’ is an obsolete function (as of
>     Org 9.2); use ‘org-get-tags’ instead.
>
> What's the canonical way to deal with such cases?
>

Replying to self.. not sure if this is the best way.. but it works. I'd
like to know if there's a way without defining and calling a macro like
this (may be there's a way to use one of the eval-* macros, but I cannot
figure out how):

;; Using the correct function for getting inherited Org tags.
(defmacro org-hugo--get-tags-alias ()
  "Generate alias to point to the correct fn for getting inherited Org
tags."
  ;; Starting Org 9.2, `org-get-tags' returns all the inherited tags
  ;; instead of returning only the local tags i.e. only the current
  ;; headline tags.
  ;;
https://code.orgmode.org/bzg/org-mode/commit/fbe56f89f75a8979e0ba48001a822518df2c66fe
  ;; For Org <= 9.1, `org-get-tags' returned a list of tags *only* at
  ;; the current heading, while `org-get-tags-at' returned inherited
  ;; tags too.
  (if (fboundp #'org--get-local-tags)   ;If using Org 9.2+
      `(defalias 'org-hugo--get-tags 'org-get-tags)
    `(defalias 'org-hugo--get-tags 'org-get-tags-at)))
(org-hugo--get-tags-alias)
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2044 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about updating a package for the org-get-tags change
  2018-04-23 16:02 Question about updating a package for the org-get-tags change Kaushal Modi
  2018-04-23 17:08 ` Kaushal Modi
@ 2018-04-23 18:11 ` Nicolas Goaziou
  2018-04-23 19:09   ` Kaushal Modi
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2018-04-23 18:11 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Hello,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> I am trying to update the ox-hugo package to work with zero warnings for
> both Org 9.1 and 9.2.

A warning is not an error. I wouldn't bother.

Anyway, you might want to look at `with-no-warnings'.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about updating a package for the org-get-tags change
  2018-04-23 18:11 ` Nicolas Goaziou
@ 2018-04-23 19:09   ` Kaushal Modi
  0 siblings, 0 replies; 4+ messages in thread
From: Kaushal Modi @ 2018-04-23 19:09 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Mon, Apr 23, 2018 at 2:11 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

>
> A warning is not an error. I wouldn't bother.
>

Well, it was bothering me as I have a hook at auto-compiles the .el file
each time I save it. Also bothers my OCD :)


> Anyway, you might want to look at `with-no-warnings'.
>

That's good to know. For now, I am using the macro-method to make ox-hugo
use the correct function for fetching inherited tags.

Thanks.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1018 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-23 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 16:02 Question about updating a package for the org-get-tags change Kaushal Modi
2018-04-23 17:08 ` Kaushal Modi
2018-04-23 18:11 ` Nicolas Goaziou
2018-04-23 19:09   ` Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).