emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Mikhail Skorzhisnkii <mskorzhinskii@eml.cc>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] ox-icalendar.el: customizable vevent summary prefix
Date: Wed, 31 Aug 2022 20:09:47 +0800	[thread overview]
Message-ID: <87v8q8obqs.fsf@localhost> (raw)
In-Reply-To: <87o7w1j0su.fsf@eml.cc>

Mikhail Skorzhisnkii <mskorzhinskii@eml.cc> writes:

> I have signed FSF papers. Attaching a rebased patch with additional changes to
> ORG-NEWS

Thanks!

> Subject: [PATCH 1/2] org-agenda.el: customize outline path in echo area
>
> * lisp/org-agenda.el (org-agenda-show-outline-path): add an option to
> show document title in outline path (instead of file name)

Please follow the commit message conventions as described in
https://orgmode.org/worg/org-contribute.html#commit-messages In
particular, start sentences from capital letters, end them with ".",
separate sentences with double space, and quote lisp symbols as
`symbol'.

> * lisp/org.el (org-get-title-from-buffer): a function to collect the
                                             New
> document title from the org-mode buffer
                                         .


> * lisp/org.el (org-display-outline-path): add logic that will collect a
> document title and put it into the outline path if
> org-agenda-show-outline-path set to 'title

This is not what the patch does.  From this message, it looks like
`org-agenda-show-outline-path' is affecting the output of
`org-display-outline-path', which is not true.

>  (defcustom org-agenda-show-outline-path t
> -  "Non-nil means show outline path in echo area after line motion."
> +  "Non-nil means show outline path in echo area after line motion.
> +
> +If set to 'title, show document title."

This is not very clear. I'd rather put more detailed explanation as in
the defcustom :type spec below.

>    :group 'org-agenda-startup
> -  :type 'boolean)
> +  :type '(choice
> +	  (const :tag "Don't show outline path in agenda view." nil)
> +	  (const :tag "Show outline path with prepended file name." t)
> +	  (const :tag "Show outline path with prepended document title. Fallback to file name is no title is present." title)))
> -(defun org-display-outline-path (&optional file current separator just-return-string)
> +(defun org-get-title-from-buffer (&optional buffer)
> +  "Collect title from the provided `org-mode' BUFFER."
> +  (let* ((buffer (or buffer (current-buffer)))
> +         (buffer (or (buffer-base-buffer buffer)
> +                     buffer))

Why not just

(or (buffer-base-buffer buffer)
    buffer
    (current-buffer))

> +         title)
> +    (with-current-buffer buffer
> +      (pcase (org-collect-keywords '("TITLE"))
> +        (`(("TITLE" . ,val))
> +         (setq title (car val)))))
> +    title))

Extra `title' variable is unnecessary here. You can simply do 

    (with-current-buffer buffer
      (pcase (org-collect-keywords '("TITLE"))
        (`(("TITLE" ,val . _))
         val)))

Also, what will happen in a file like

#+TITLE: Begin title
#+TITLE: .. end title

?

> +(defun org-display-outline-path (&optional file-or-title current separator just-return-string)
>    "Display the current outline path in the echo area.
>  
> -If FILE is non-nil, prepend the output with the file name.
> +If FILE-OR-TITLE is 'title, prepend outline with file title.  If
> +it is non-nil or title is not present in document, prepend
> +outline path with the file name.
>  If CURRENT is non-nil, append the current heading to the output.
>  SEPARATOR is passed through to `org-format-outline-path'.  It separates
>  the different parts of the path and defaults to \"/\".
> @@ -7407,6 +7421,8 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message."
>    (interactive "P")
>    (let* (case-fold-search
>  	 (bfn (buffer-file-name (buffer-base-buffer)))
> +         (title-prop (when (and file-or-title (eq file-or-title 'title))

can be simply (eq file-or-title 'title)

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


  reply	other threads:[~2022-08-31 12:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25 15:24 [PATCH] ox-icalendar.el: customizable vevent summary prefix Mikhail Skorzhinskii
2021-12-26 21:26 ` Nicolas Goaziou
2021-12-28 12:10   ` Mikhail Skorzhinskii
2022-07-31  7:16     ` Ihor Radchenko
2022-07-31  7:35       ` Mikhail Skorzhinskiy
2022-07-31 13:02         ` Ihor Radchenko
2022-08-30 13:50           ` Mikhail Skorzhisnkii
2022-08-31 12:09             ` Ihor Radchenko [this message]
2022-09-05 18:50               ` Mikhail Skorzhisnkii
2022-09-08  5:40                 ` Ihor Radchenko
2022-09-08 20:10                   ` Mikhail Skorzhisnkii
2022-09-09 10:13                     ` Ihor Radchenko
2022-10-23 19:15                       ` Mikhail Skorzhisnkii
2022-10-25  6:59                         ` Ihor Radchenko
2022-08-31 12:11             ` Ihor Radchenko
2022-09-01  7:29               ` Bastien
2022-08-31 12:13             ` Ihor Radchenko
2022-09-05 18:59               ` Mikhail Skorzhisnkii
2022-09-05 19:28             ` Mikhail Skorzhisnkii
2022-09-08  5:33               ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8q8obqs.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mskorzhinskii@eml.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).