Re: Emacs on the beach?

2022-08-15 Thread Bob Newell


Jean Louis  writes:

> * ypuntot  [2022-06-15 21:08]:
>> If you wanted to play with Emacs on the beach or sitting in front of
>> your home, what would be your emacser setup?

I live in Waikiki and the beach is a five minute walk from
home.

I would have my Android phone, which I've set up with Termux
and my full Emacs working environment of course including all
the org-mode stuff that I pretty much live by. I could do a
good 95% of what I can do at home while on the beach.

A Bluetooth keyboard would help, of course. And an umbrella
for shade since my phone screen doesn't do well in bright
sunlight.

But of course I wouldn't do any of that because that's not why
I would go to the beach in the first place!

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU/Linux/Emacs/Gnus/BBDB



Re: Bug? org-id-find not finding some IDs

2022-08-15 Thread Ihor Radchenko
Jack Kamm  writes:

> Ihor Radchenko  writes:
>
>> Applied onto main via 8f5bf1725.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=8f5bf172556564df89fb16ce8ecec68c5b7f0221
>
> My sincere apologies, but after a bit of testing, I found that my
> requested change had some unforeseen consequences, and I don't think
> it's a good idea anymore. So, I'd like to request reverting it.
>
> Doing some research, I found the behavior of org-id-update-id-locations,
> to not search all the open Org files, was made in this 2019 commit:
>
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9865e6bd8be65229be4eac4f459f62e47fab2be7
>
> The commit message suggests this change in behavior was
> intentional. Only, the docstring of org-id-extra-files wasn't updated to
> reflect the new behavior, which was the cause of confusion on my end.

That particular change has not been noticed in the relevant ML thread.
I disagree that skipping the open ID files is the right decision.
We already have org-id-get unconditionally adding arbitrary files
to the ID locations. This org-id-get can be triggered in various
unpredictable places inside Org and third-party packages. Thus, we cannot
really expect consistency even after reverting the commit.

> In terms of unforeseen consequences of the new commit: I found it caused
> some problems for org-caldav. When making changes, org-caldav copies
> entries into a backup file at ~/.emacs.d/org-caldav-backup.org. With the
> new commit, it is sometimes finding entries in this backup file instead
> of the correct file.

I suggest to bind org-id-track-globally to nil file-locally in that
backup file. I believe that org-id-track-globally, when set to t, is
expected to catch all the Org files in Emacs + user-specified files.
Skipping some opened files unpredictably, like it was done before
my commit is chaotic and also caused confusion in this area in my own
Org usage.

If necessary, we may add an extra customization like
org-id-exclude-files to explicitly exclude files from ID tracking.

-- 
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



[FEATURE REQUEST] statistics of repeated tasks

2022-08-15 Thread Ihor Radchenko
Abhisek Panigrahi  writes:

> I would have worked on the patch, but I don't know elisp or lisp language!

Then, you may detail your proposal on how you envision this new
statistics feature: (1) how and where it should be displayed; (2) when
it is going to be useful.

Note that I changed the email subject to bring this thread to the
attention of other Org mailing list members.

If there is sufficient interest, someone else may step up and implement
the feature.

I will probably add this to my todo-list, but my list is very too long
already. I currently prioritize bugs and more widely requested features.

-- 
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



Re: Emacs on the beach?

2022-08-15 Thread Quiliro Ordóñez
El 2022-08-15 10:45, Jean Louis escribió:
> * ypuntot  [2022-06-15 21:08]:
>> If you wanted to play with Emacs on the beach or sitting in front of
>> your home, what would be your emacser setup?
> 
> On the beach, I would be creative and use Markdown to write articles
> for websites. It would include capturing pictures by mobile phone and
> sorting them into a note taking system.

Why not publish directly with org?

> In front of my home, I would let Emacs send my advertising to
> thousands of people while I would enjoy in swimming pool.

How do you advertize with Emacs to thousands of people?  (Now few
non-hackers use email.)

Great image about working on Emacs on the beach, by the way.  :-)



Re: Bad save performance on `main` branch

2022-08-15 Thread Ihor Radchenko
Ragnar Groot Koerkamp  writes:

> Steps to reproduce are already in [1], but I hope the profiles below should
> give a start at finding the cause of this issue.

I am sorry, but I am unable to reproduce anything using the provided
.org file. The file contains references to non-existing bibliography.

Could you please detail the steps starting from emacs -Q?

> org-export-copy-buffer
>   5039  64%  - # 0x282f7cab5f98f9e>
>   4994  63%   - org-mode
>   4499  57%- run-mode-hooks
>   4485  57% - run-hooks

This is very odd. org-export-copy-buffer explicitly disables all the
mode hooks:

  ;; Set major mode. Ignore `org-mode-hook' as it has been run
  ;; already in BUFFER.
  (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode))

-- 
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



Potential bug: Invalid function: org-encode-time

2022-08-15 Thread Duy Nguyen
Hi everyone,

I am having issues trying to use the latest version of Org with straight
(the built-in version works fine. Currently testing with a minimal config,
i.e. I only have the necessary code to enable straight and use-package in
my init.el, and I have added the following as well:

(use-package org
  :straight t)

Initially, when I generate an ~org-clock-report~ table it works just fine.
However, at some random point it stops working and just gives me the
following error: "Invalid function: org-encode-time". Not sure if I
explained it well, so here is a short video 
to show what is happening (I am continuously pressing C-c to refresh the
org clock table).

If I manually delete the contents of the =eln-cache= folder and restart
emacs, I can use ~org-clock-report~ again, but at some point it will just
give me the same error just like in the video.

Anyone could help me find out what the issue is?

Thanks,
Duy


[PATCH v2] Show org file title in org-clock clocktable

2022-08-15 Thread Duy Nguyen
>
> We usually use ~code~ for Elisp symbols and code. So, =t= -> ~t~ and
> ~File~ -> "File". See doc/Documentation_Standards.org


Please, escape #+BEGIN with comma: ,#+BEGIN.
> (this is done automatically if you use C-c ' to edit the src block)


By convention, we consider a document title to be concatenation of all
> the values of #+TITLE keyword inside buffer.


Thank you once again for your comments Ihor. Please find attached a new
patch with your comments addressed.

Duy
From 090811a1bce0d6c6f3469564c4e7cf89b07e8fb6 Mon Sep 17 00:00:00 2001
From: Duy Nguyen 
Date: Fri, 12 Aug 2022 18:40:10 +0200
Subject: [PATCH v2] lisp/org-clock.el: Show file title in org-clock clocktable

* lisp/org-clock.el (org-clocktable-defaults): Add default value for
new clock table option `:filetitle'.
(org-clock-get-file-title): Add new function to extract title of org file.
(org-clocktable-write-default): Print org file name in clock table if
`:filetitle' is set to `t'.

* doc/org-manual.org (The clock table): Include new `:filetitle'
option in manual for clock table.

* etc/ORG-NEWS (New =:filetitle= option for clock table): Include new
`:filetitle' option for clock table.

Allow user to show org file title instead of file name in the
clock table.  If the file does not have a title defined, the file name
will be shown in the clock table.

TINYCHANGE
---
 doc/org-manual.org |  4 
 etc/ORG-NEWS   | 13 +
 lisp/org-clock.el  | 17 -
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 466718e6e..046da3790 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -6797,6 +6797,10 @@ using the =:formatter= parameter.
 
   Indent each headline field according to its level.
 
+- =:filetitle= ::
+
+  Show title in the file column if the file has a =#+title=.
+ 
 - =:hidefiles= ::
 
   Hide the file column when multiple files are used to produce the
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 00fe101dc..eefe4adc2 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -270,6 +270,19 @@ example,
 
 prints a sub-bibliography containing the book entries with =ai= among
 their keywords.
+*** New =:filetitle= option for clock table
+
+The =:filetitle= option for clock tables can be set to ~t~ to show org
+file title (set by =#+title:=) in the File column instead of the
+file name. For example:
+
+#+begin_src org
+,#+BEGIN: clocktable :scope agenda :maxlevel 2 :block thisweek :filetitle t
+#+end_src
+
+If a file does not have a title, the table will show the file name
+instead.
+
 ** New options
 *** A new custom setting =org-hide-drawer-startup= to control initial folding state of drawers
 
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 362abe358..f1d1f208b 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -324,6 +324,7 @@ string as argument."
:link nil
:narrow '40!
:indent t
+   :filetitle nil
:hidefiles nil
:formula nil
:timestamp nil
@@ -2469,6 +2470,17 @@ the currently selected interval size."
 	  (org-update-dblock)
 	  t)
 
+;;;###autoload
+(defun org-clock-get-file-title (file-name)
+  "Get the file title from FILE-NAME as a string. Returns short
+FILE-NAME if title is not found."
+  (with-current-buffer (find-file-noselect file-name)
+(let ((macros (org-macro--collect-macros)))
+  (let ((title (assoc-default "title" macros)))
+(if (null title)
+(file-name-nondirectory file-name)
+  title)
+
 ;;;###autoload
 (defun org-dblock-write:clocktable (params)
   "Write the standard clocktable."
@@ -2584,6 +2596,7 @@ from the dynamic block definition."
 	 (emph (plist-get params :emphasize))
 	 (compact? (plist-get params :compact))
 	 (narrow (or (plist-get params :narrow) (and compact? '40!)))
+	 (filetitle (plist-get params :filetitle))
 	 (level? (and (not compact?) (plist-get params :level)))
 	 (timestamp (plist-get params :timestamp))
 	 (tags (plist-get params :tags))
@@ -2723,7 +2736,9 @@ from the dynamic block definition."
 			 (if (eq formula '%) " %s |" "")
 			 "\n")
 
-		 (file-name-nondirectory file-name)
+ (if filetitle
+ (org-clock-get-file-title file-name)
+   (file-name-nondirectory file-name))
 		 (if level?"| " "") ;level column, maybe
 		 (if timestamp "| " "") ;timestamp column, maybe
 		 (if tags  "| " "") ;tags column, maybe
-- 
2.32.1 (Apple Git-133)



Re: bug#57213: 27.1; statistics of repeated tasks

2022-08-15 Thread Abhisek Panigrahi
Thanks for the reply Ihor,

I would have worked on the patch, but I don't know elisp or lisp language!

- Abhisek

On Mon, Aug 15, 2022 at 9:28 AM Ihor Radchenko  wrote:

> Forwarding from debbugs.
>
> Abhisek, we usually discuss Org development in a dedicated mailing list.
> See https://orgmode.org/manual/Feedback.html
>
> As for your suggestion, the idea is reasonable. Patches are welcome :)
>
> Note that statistic cookies have a very specific format [NN%] or [N/M].
> I guess you can treat, say, [NN%] as percentage of time the habit was
> actually done vs. planned to be done.
>
> Also, you may modify org-habit-insert-consistency-graphs to provide more
> statistic information.
>
>
>  Start of forwarded message 
> Subject: bug#57213: 27.1; statistics of repeated tasks
> To: 57...@debbugs.gnu.org
> From: Abhisek Panigrahi 
> Date: Sun, 14 Aug 2022 23:00:22 +0530
>
>
> I can't seem to find statistics of repeated tasks. However, I can see the
> cookies of the TODO tasks like
> https://orgmode.org/manual/Breaking-Down-Tasks.html. I'm using the
> editor for more than 5 years now and org-mode for more than 2
> years. There is some solution for every area of editing, however when I
> tried to see how many times I have completed a specific task, there is
> no way.
>
> There are some hacks I found on the internet, but either that is
> incomplete or unusable. I don't know why it isn't builtin yet ?
> This feature is very useful inside *habit* module atleast. Because by
> seeing your statistics you get motivated and want to keep the streak
> going.
>
> Some suggestion to include in this feature
> * last streak count
> * highest streak count
> * total times the task was DONE
>
> If you feel there are some additional statistics or different useful
> statistics should be included, please do so. I would be glad to be in
> the discussion.
>
>
>
>
>
> In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
>  of 2020-08-21 built on CIRROCUMULUS
> Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
> Repository branch: HEAD
> Windowing system distributor 'Microsoft Corp.', version 10.0.19044
> System Description: Microsoft Windows 10 Home Single Language
> (v10.0.2009.19044.1889)
>
> Recent messages:
> Entry repeats: SCHEDULED: <2022-08-16 Tue .+2d>
> Note stored
> Entry repeats: SCHEDULED: <2022-08-16 Tue .+2d>
> Saving file d:/schedules/example.org...
> Wrote d:/schedules/example.org
> Saving file d:/schedules/example.org...
> Wrote d:/schedules/example.org
> Saving file d:/schedules/example.org...
> Wrote d:/schedules/example.org
> Press key for agenda command (unrestricted):
>
> Configured using:
>  'configure --without-dbus --host=x86_64-w64-mingw32
>  --without-compress-install 'CFLAGS=-O2 -static''
>
> Configured features:
> XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
> HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP
>
> Important settings:
>   value of $LANG: ENN
>   locale-coding-system: cp1252
>
> Major mode: Org-Agenda Week Ddl Grid Habit
>
> Minor modes in effect:
>   tooltip-mode: t
>   global-eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   buffer-read-only: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort mail-extr emacsbug sendmail cl-extra org-lint ox-odt
> rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse
> nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table
> ox-ascii ox-publish ox org-habit thingatpt help-fns radix-tree help-mode
> cus-edit cus-start cus-load org-timer org-colview org-clock org-attach
> org-id org-archive cal-move diary-lib diary-loaddefs cal-iso org-agenda
> misearch multi-isearch mule-util info org-element avl-tree generator
> ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnir gnus-sum url
> url-proxy url-privacy url-expand url-methods url-history mailcap shr
> url-cookie url-domsuf url-util svg xml dom gnus-group gnus-undo
> gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
> parse-time iso8601 gnus-spec gnus-int gnus-range message rmc puny rfc822
> mml mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode
> mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus
> nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
> text-property-search mail-utils mm-util mail-prsvr wid-edit ol-docview
> doc-view jka-compr image-mode exif dired dired-loaddefs ol-bibtex bibtex
> ol-bbdb ol-w3m org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
> org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color
> ring org-list org-faces org-entities time-date noutline outline
> easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table ol
> org-keys org-compat advice 

Bad save performance on `main` branch

2022-08-15 Thread Ragnar Groot Koerkamp
Hi all,

I ran into an issue [1] [2] with ox-hugo where exporting an org file on
auto-save takes very long (3+ seconds) compared to ~0.2s normally. This is
using commit 00adad935 on the main branch from a few days back (using
Doom). See below for a cpu profile.

After switching back to the bugfix branch (6e991f4bb), the auto-save is
fast again. Again see the cpu profile below.

Steps to reproduce are already in [1], but I hope the profiles below should
give a start at finding the cause of this issue.

Thanks!

1: https://github.com/kaushalmodi/ox-hugo/issues/665
2: https://github.com/kaushalmodi/ox-hugo/discussions/551

Slow ~3s export on branch main (00adad935):

  7354  93% - command-execute
  7354  93%  - funcall-interactively
  7354  93%   - save-buffer
  7354  93%- basic-save-buffer
  7349  93% - run-hooks
  7323  93%  - org-hugo-export-wim-to-md-after-save
  7323  93%   - org-hugo-export-wim-to-md
  7321  93%- org-hugo--export-file-to-md
  7318  93% - org-hugo-export-to-md
  7314  92%  - org-export-to-file
  7314  92%   - apply
  7305  92%- +org--fix-async-export-a
  7305  92% - let
  7305  92%  - apply
  7305  92%   - #
  7305  92%- apply
  7305  92% - +org--dont-trigger-save-hooks-a
  7305  92%  - let
  7305  92%   - apply
  7305  92%- #
  7301  92% - org-export-as
  7301  92%  - apply
  7301  92%   - +org--fix-async-export-a
  7301  92%- let
  7298  92% - apply
  7298  92%  - #
  6991  88%   - org-export-data
  6991  88%- mapconcat
  6991  88% - #
  6991  88%  - org-export-data
  6987  88%   - mapconcat
  6987  88%- #
  6983  88% - org-export-data
  6977  88%  - mapconcat
  6977  88%   - #
  6977  88%- org-export-data
  6971  88% - mapconcat
  6971  88%  - #
  6971  88%   - org-export-data
  6775  86%- mapconcat
  6775  86% - #
  6775  86%  - org-export-data
  5356  68%   -
org-blackfriday-latex-fragment
  5354  68%-
org-html-format-latex
  5321  67% -
org-export-copy-buffer
  5039  64%  - #
  4994  63%   - org-mode
  4499  57%- run-mode-hooks
  4485  57% - run-hooks
  1777  22%  +
global-flycheck-mode-enable-in-buffers
   939  11%  +
global-emojify-mode-enable-in-buffers
   556   7%  +
evil-mode-enable-in-buffers
   449   5%  +
yas-global-mode-enable-in-buffers
   322   4%  +
ws-butler-global-mode-enable-in-buffers
   254   3%  +
global-company-mode-enable-in-buffers
   122   1%  +
global-font-lock-mode-enable-in-buffers
38   0%  +
+format-enable-on-save-maybe-h
 7   0%  +
global-undo-fu-session-mode-enable-in-buffers
 6   0%  +
global-anzu-mode-enable-in-buffers
 6   0%  +
global-evil-surround-mode-enable-in-buffers
 3   0%  +
evil-snipe-override-mode-enable-in-buffers
14   0% + apply
   157   1%+ outline-mode
   123   1%+
org-fold-initialize
96   1%+
org-element-cache-reset
49   0%+ add-hook
36   0%+
org-install-agenda-files-menu
13   0%+
org-set-regexps-and-options
 7   0%+

Re: Emacs on the beach?

2022-08-15 Thread Jean Louis
* ypuntot  [2022-06-15 21:08]:
> If you wanted to play with Emacs on the beach or sitting in front of
> your home, what would be your emacser setup?

On the beach, I would be creative and use Markdown to write articles
for websites. It would include capturing pictures by mobile phone and
sorting them into a note taking system.

In front of my home, I would let Emacs send my advertising to
thousands of people while I would enjoy in swimming pool.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: how to concatenate string to spreadsheet formula

2022-08-15 Thread Fraga, Eric
Hi Edgar,

I did not quite understand what you actually were calculating but maybe
consider the following expression for table formulas:

#+TBLFM: $3='(format "%s\\textwidth" (/ (* 1.0 $2) $1));N

If you specify ";N", the entries are treated as numbers.  The problem
with division is that if both numbers are integers, integer division is
used so I multiply one of the arguments by 1.0 to ensure floating point
numbers.

HTH,
eric

-- 
: Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50


how to concatenate string to spreadsheet formula

2022-08-15 Thread edgar

Dear everyone,

At the moment, I am using an Org spreadsheet to concatenate a string  
to the ratio between 2 numbers. One of numbers is the  
[[sum-of-column][sum of a column]]. The other number would correspond  
to [[each-row-col1][each of the rows of another column]]  
([[ratio-to-0.95][multiplied by a factor]])

1. <>calculate the sum of a column
   - originally wanted vsum
   - corresponding part: =(reduce '+ (mapcar 'string-to-number (list  
@5$<..@6$<)))=

2. <>each of the values in column 1
   (string-to-number $1)
3. <>the ratio between [[each-row-col1]] and  
[[sum-of-column]] is multiplied by 0.95


The final value is concatenated with "\\textwidth".

| width | height |  w / Σw |   w / pic_row |
|   204 |120 |  0.10418795 |0.32606557 |
|   215 |125 |  0.10980592 |0.34364754 |
|   191 |119 | 0.097548519 |0.30528689 |
|   483 |125 |  0.24668029 |  0.7294912559614499\textwidth |
|   146 |128 | 0.074565884 | 0.22050874403854998\textwidth |
|   719 |101 |  0.36721144 |   |
|---++-+---|
|  1958 |718 | |   |
#+tblfm: @5$4..@6$4='(concat (number-to-string (* 0.95  
(string-to-number (math-format-number (math-div (string-to-number $1)  
(reduce '+ (mapcar 'string-to-number (list @5$<..@6$<  
"\\textwidth")


Is there a more succint way of doing this? For instance, my original  
intention was to have something like


#+tblfm: @5$4..@6$4=vsum($1 / vsum(@5$<..@6$<);"%0.4f\\textwidth"

which does not work. I would also like to avoid creating another  
column (=#+tblfm: @5$4..@6$4=vsum($1 /  
vsum(@5$<..@6$<);%0.4f::@<<$5..@>>$5='(concat $4 "\\textwidth")=).


Thank you very much!


-
This free account was provided by VFEmail.net - report spam to ab...@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!