aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rwxr-xr-xautogen.sh2
-rw-r--r--contrib/caldav/README.md28
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py20
-rw-r--r--contrib/caldav/config.sample9
-rwxr-xr-xcontrib/caldav/hooks/post-sync34
-rwxr-xr-xcontrib/hooks/post-save38
-rwxr-xr-xcontrib/hooks/pre-load10
-rw-r--r--contrib/vdir/README.md3
-rwxr-xr-xcontrib/vdir/calcurse-vdirsyncer2
-rw-r--r--doc/calcurse.1.txt62
-rw-r--r--doc/credits.txt2
-rw-r--r--doc/de/credits.txt2
-rw-r--r--doc/es/credits.txt2
-rw-r--r--doc/fr/credits.txt2
-rw-r--r--doc/manual.txt68
-rw-r--r--doc/nl/credits.txt2
-rw-r--r--doc/pt_BR/credits.txt2
-rw-r--r--doc/ru/credits.txt2
-rw-r--r--doc/save.txt12
-rw-r--r--doc/submitting-patches.txt2
-rw-r--r--po/calcurse.pot11
-rw-r--r--scripts/calcurse-upgrade.sh.in4
-rw-r--r--src/apoint.c2
-rw-r--r--src/args.c4
-rw-r--r--src/calcurse.c2
-rw-r--r--src/calcurse.h13
-rw-r--r--src/config.c2
-rw-r--r--src/custom.c2
-rw-r--r--src/day.c2
-rw-r--r--src/dmon.c2
-rw-r--r--src/event.c2
-rw-r--r--src/getstring.c2
-rw-r--r--src/help.c2
-rw-r--r--src/hooks.c2
-rw-r--r--src/htable.h2
-rw-r--r--src/ical.c2
-rw-r--r--src/io.c97
-rw-r--r--src/keys.c4
-rw-r--r--src/listbox.c2
-rw-r--r--src/llist.c2
-rw-r--r--src/llist.h2
-rw-r--r--src/llist_ts.h2
-rw-r--r--src/mem.c2
-rw-r--r--src/note.c2
-rw-r--r--src/notify.c13
-rw-r--r--src/pcal.c2
-rw-r--r--src/queue.c2
-rw-r--r--src/recur.c2
-rw-r--r--src/sha1.c2
-rw-r--r--src/sha1.h2
-rw-r--r--src/sigs.c2
-rw-r--r--src/strings.c2
-rw-r--r--src/todo.c2
-rw-r--r--src/ui-calendar.c2
-rw-r--r--src/ui-day.c31
-rw-r--r--src/ui-todo.c2
-rw-r--r--src/utf8.c2
-rw-r--r--src/utils.c4
-rw-r--r--src/vars.c2
-rw-r--r--src/vector.c2
-rw-r--r--src/vector.h2
-rw-r--r--src/wins.c2
-rw-r--r--test/Makefile.am6
-rw-r--r--test/README2
-rwxr-xr-xtest/io-001.sh10
-rwxr-xr-xtest/io-002.sh11
-rwxr-xr-xtest/io-003.sh12
-rwxr-xr-xtest/io-004.sh12
-rwxr-xr-xtest/io-005.sh11
-rwxr-xr-xtest/io-006.sh12
-rw-r--r--test/run-test.c2
72 files changed, 437 insertions, 194 deletions
diff --git a/COPYING b/COPYING
index 333597b..d3ebf1b 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/autogen.sh b/autogen.sh
index f737ace..55c7768 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+# Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/contrib/caldav/README.md b/contrib/caldav/README.md
index b6f6cbf..a842081 100644
--- a/contrib/caldav/README.md
+++ b/contrib/caldav/README.md
@@ -17,10 +17,12 @@ Usage
-----
calcurse-caldav requires an up-to-date version of calcurse and a configuration
-file located at ~/.calcurse/caldav/config. An example configuration file can be
-found under contrib/caldav/config.sample in the calcurse source tree. You will
-also need to install *httplib2* for Python 3 using *pip* (e.g. `pip3 install
---user httplib2`) or your distribution's package manager.
+file located at $XDG_CONFIG_HOME/calcurse/caldav/config
+(~/.local/share/calcurse/caldav/config) or ~/.calcurse/caldav/config if
+~/.calcurse exists. An example configuration file can be found under
+contrib/caldav/config.sample in the calcurse source tree. You will also need to
+install *httplib2* for Python 3 using *pip* (e.g. `pip3 install --user
+httplib2`) or your distribution's package manager.
If you run calcurse-caldav for the first time, you need to provide the `--init`
argument. You can choose between the following initialization modes:
@@ -43,9 +45,11 @@ CALCURSE_CALDAV_PASSWORD=$(pass show calcurse) calcurse-caldav
Hooks
-----
-You can place scripts in `$HOME/.calcurse/caldav/hooks/` to trigger actions at
-certain events. To enable a hook, add a script with one of the following names
-to this directory. Also make sure the scripts are executable.
+You can place scripts in `$XDG_CONFIG_HOME/calcurse/caldav/hooks/`
+(`~/.config/calcurse/caldav/hooks`) or `~/.calcurse/caldav/hooks` if
+`~/.calcurse` exists in order to trigger actions at certain events. To enable a
+hook, add a script with one of the following names to this directory. Also make
+sure the scripts are executable.
*pre-sync*::
Executed before the data files are synchronized.
@@ -59,10 +63,12 @@ How It Works
------------
calcurse-caldav creates a so-called synchronization database at
-`~/.calcurse/caldav/sync.db` that always keeps a snapshot of the last time the
-script was executed. When running the script, it compares the objects on the
-server and the local objects with that snapshot to identify items that were
-added or deleted. It then
+`$XDG_DATA_HOME/calcurse/caldav/sync.db`
+(`~/.local/share/calcurse/caldav/sync.db`) or `~/.calcurse/caldav/sync.db` if
+`~/.calcurse` exists that always keeps a snapshot of the last time the script
+was executed. When running the script, it compares the objects on the server
+and the local objects with that snapshot to identify items that were added or
+deleted. It then
* downloads new objects from the server and imports them into calcurse,
* deletes local objects that no longer exist on the server,
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py
index d247f80..beea376 100755
--- a/contrib/caldav/calcurse-caldav.py
+++ b/contrib/caldav/calcurse-caldav.py
@@ -519,11 +519,21 @@ def run_hook(name):
nsmap = {"D": "DAV:", "C": "urn:ietf:params:xml:ns:caldav"}
# Initialize default values.
-configfn = os.path.expanduser("~/.calcurse/caldav/config")
-lockfn = os.path.expanduser("~/.calcurse/caldav/lock")
-syncdbfn = os.path.expanduser("~/.calcurse/caldav/sync.db")
-hookdir = os.path.expanduser("~/.calcurse/caldav/hooks/")
-oauth_file = os.path.expanduser("~/.calcurse/caldav/oauth2_cred")
+if os.path.isdir(os.path.expanduser("~/.calcurse")):
+ configfn = os.path.expanduser("~/.calcurse/caldav/config")
+ lockfn = os.path.expanduser("~/.calcurse/caldav/lock")
+ syncdbfn = os.path.expanduser("~/.calcurse/caldav/sync.db")
+ hookdir = os.path.expanduser("~/.calcurse/caldav/hooks/")
+ oauth_file = os.path.expanduser("~/.calcurse/caldav/oauth2_cred")
+else:
+ calcurse_data = os.getenv("XDG_DATA_HOME", os.path.expanduser("~/.local/share")) + "/calcurse"
+ calcurse_config = os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.config")) + "/calcurse"
+
+ configfn = os.path.expanduser(calcurse_config + "/caldav/config")
+ lockfn = os.path.expanduser(calcurse_data + "/caldav/lock")
+ syncdbfn = os.path.expanduser(calcurse_data + "/caldav/sync.db")
+ hookdir = os.path.expanduser(calcurse_config + "/caldav/hooks/")
+ oauth_file = os.path.expanduser(calcurse_config + "/caldav/oauth2_cred")
# Parse command line arguments.
parser = argparse.ArgumentParser('calcurse-caldav')
diff --git a/contrib/caldav/config.sample b/contrib/caldav/config.sample
index 4d87681..c89cfb7 100644
--- a/contrib/caldav/config.sample
+++ b/contrib/caldav/config.sample
@@ -1,6 +1,11 @@
# If you want to synchronize calcurse with a CalDAV server using
-# calcurse-caldav, create a new directory ~/.calcurse/caldav/, copy this file
-# to ~/.calcurse/caldav/config and adjust the configuration below.
+# calcurse-caldav, create a new directory at $XDG_CONFIG_HOME/calcurse/caldav/
+# (~/.config/calcurse/caldav/) and $XDG_DATA_HOME/calcurse/caldav/
+# (~/.local/share/calcurse/caldav/) and copy this file to
+# $XDG_CONFIG_HOME/calcurse/caldav/config and adjust the configuration below.
+# Alternatively, if using ~/.calcurse, create a new directory at
+# ~/.calcurse/caldav/ and copy this file to ~/.calcurse/caldav/config and adjust
+# the configuration file below.
[General]
# Path to the calcurse binary that is used for importing/exporting items.
diff --git a/contrib/caldav/hooks/post-sync b/contrib/caldav/hooks/post-sync
index 1ac028c..62ebe11 100755
--- a/contrib/caldav/hooks/post-sync
+++ b/contrib/caldav/hooks/post-sync
@@ -4,14 +4,32 @@
# repository, it automatically makes a commit whenever synchronizing with a
# CalDAV server.
#
-# In order to install this hook, copy this file to ~/.calcurse/caldav/hooks/.
+# In order to install this hook, copy this file to
+# $XDG_CONFIG_HOME/calcurse/caldav/hooks/ (~/.config/calcurse/caldav/hooks/) or
+# ~/.calcurse/caldav/hooks/ if using ~/.calcurse.
-cd "$HOME"/.calcurse/
+data_dir="$HOME/.calcurse"
+config_dir="$HOME/.calcurse"
-# If the data directory is under version control, create a Git commit.
-if [ -d .git -a -x "$(which git)" ]; then
- git add apts conf keys todo
- if ! git diff-index --quiet --cached HEAD; then
- git commit -m "Automatic commit by the post-sync hook"
- fi
+if [ ! -d "$data_dir" ]; then
+ data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse"
+ config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/calcurse"
fi
+
+# Do not do anything when synchronizing with a CalDAV server.
+[ -f "$data_dir/caldav/lock" ] && exit
+
+# If the directory is under version control, create a Git commit.
+commit_dir() {
+ cd "$1" >/dev/null 2>&1 || return
+ shift
+ if [ -d .git ] && command -v git >/dev/null; then
+ git add "$@"
+ if ! git diff-index --quiet --cached HEAD; then
+ git commit -m "Automatic commit by the post-save hook"
+ fi
+ fi
+}
+
+commit_dir "$data_dir" apts todo
+commit_dir "$config_dir" conf keys
diff --git a/contrib/hooks/post-save b/contrib/hooks/post-save
index bb582e2..6e3f11e 100755
--- a/contrib/hooks/post-save
+++ b/contrib/hooks/post-save
@@ -2,26 +2,42 @@
#
# This is an example hook. It does two things whenever you save the data files:
#
-# 1. Make a commit if the calcurse data directory contains a Git repository.
+# 1. Make a commit if the calcurse directories contain a Git repository.
# 2. Synchronize with a CalDAV server if calcurse-caldav is configured.
#
-# In order to install this hook, copy this file to ~/.calcurse/hooks/.
+# In order to install this hook, copy this file to
+# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or
+# ~/.calcurse/hooks/ if using ~/.calcurse.
-cd "$HOME"/.calcurse/
+data_dir="$HOME/.calcurse"
+config_dir="$HOME/.calcurse"
+
+if [ ! -d "$data_dir" ]; then
+ data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse"
+ config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/calcurse"
+fi
# Do not do anything when synchronizing with a CalDAV server.
-[ -f caldav/lock ] && exit
+[ -f "$data_dir/caldav/lock" ] && exit
-# If the data directory is under version control, create a Git commit.
-if [ -d .git -a -x "$(which git)" ]; then
- git add apts conf keys todo
- if ! git diff-index --quiet --cached HEAD; then
- git commit -m "Automatic commit by the post-save hook"
+# If the directory is under version control, create a Git commit.
+commit_dir() {
+ cd "$1" >/dev/null 2>&1 || return
+ shift
+ if [ -d .git ] && command -v git >/dev/null; then
+ git add "$@"
+ if ! git diff-index --quiet --cached HEAD; then
+ git commit -m "Automatic commit by the post-save hook"
+ fi
fi
-fi
+}
+
+commit_dir "$data_dir" apts todo
+commit_dir "$config_dir" conf keys
# Optionally run the CalDAV synchronization script in the background.
-if [ -d caldav -a -x "$(which calcurse-caldav)" ]; then
+cd "$data_dir" || exit
+if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then
(
date="$(date +'%b %d %H:%M:%S')"
echo "$date Running calcurse-caldav from the post-save hook..."
diff --git a/contrib/hooks/pre-load b/contrib/hooks/pre-load
index c9ab62d..d69fbde 100755
--- a/contrib/hooks/pre-load
+++ b/contrib/hooks/pre-load
@@ -3,15 +3,19 @@
# This is an example hook. It synchronizes calcurse with a CalDAV server before
# loading the data files.
#
-# In order to install this hook, copy this file to ~/.calcurse/hooks/.
+# In order to install this hook, copy this file to
+# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or
+# ~/.calcurse/hooks/ if using ~/.calcurse.
-cd "$HOME"/.calcurse/
+[ -d "$HOME/.calcurse" ] && data_dir="$HOME/.calcurse" || data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse"
+
+cd "$data_dir" || exit
# Do not do anything when synchronizing with a CalDAV server.
[ -f caldav/lock ] && exit
# Run the CalDAV synchronization script in the background.
-if [ -d caldav -a -x "$(which calcurse-caldav)" ]; then
+if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then
(
date="$(date +'%b %d %H:%M:%S')"
echo "$date Running calcurse-caldav from the pre-load hook..."
diff --git a/contrib/vdir/README.md b/contrib/vdir/README.md
index b040d04..676b94c 100644
--- a/contrib/vdir/README.md
+++ b/contrib/vdir/README.md
@@ -39,7 +39,8 @@ destination, potentially deleting events in the destination that are no longer
present in the origin.
You can optionally specify an alternative directory for local calcurse data
-using the `-D` flag if it differs from the default `~/.calcurse`.
+using the `-D` flag if it differs from the default `$XDG_DATA_HOME/calcurse`
+(`~/.local/share/calcurse`) or `~/.calcurse`.
Integration with vdirsyncer
---------------------------
diff --git a/contrib/vdir/calcurse-vdirsyncer b/contrib/vdir/calcurse-vdirsyncer
index c5371b5..2ac849a 100755
--- a/contrib/vdir/calcurse-vdirsyncer
+++ b/contrib/vdir/calcurse-vdirsyncer
@@ -34,7 +34,7 @@ if [ "$#" -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
fi
-DATADIR="$HOME/.calcurse"
+[ -d "$HOME/.calcurse" ] && DATADIR="$HOME/.calcurse" || DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse"
VERBOSE=""
FORCE=""
diff --git a/doc/calcurse.1.txt b/doc/calcurse.1.txt
index 13297cf..d8275d6 100644
--- a/doc/calcurse.1.txt
+++ b/doc/calcurse.1.txt
@@ -1,6 +1,6 @@
////
/*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -95,7 +95,7 @@ subsections contain some general desriptions of command line options and usage.
Input and Output Date Format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Many options require a 'date' argument, and query results per day are set apart
+Many options require a 'date' argument, and query results per day are set apart
by a leading 'date line'.
The input format of 'date' options and the output format of 'date lines' are
@@ -143,19 +143,17 @@ are marked "('also interactively')".
*-c* 'file', *--calendar* 'file'::
('also interactively') Specify the calendar file to use. The default
- calendar is *~/.calcurse/apts* (see <<_files,FILES>>). If 'file' is not an
- absolute path name, it is interpreted relative to the current working
+ calendar is located at *<datadir>/apts* (see <<_files,FILES>>). If 'file' is
+ not an absolute path name, it is interpreted relative to the current working
directory. The option has precedence over *-D*.
*-C* 'dir', *--confdir* 'dir'::
- ('also interactively') Specify the configuration directory to use. If not
- specified, the default directory is *~/.calcurse/*. See <<_files,FILES>> for
- the interaction with *-D*.
+ ('also interactively') Specify the configuration directory to use. See section
+ <<_files,FILES>> for the default directory and the interaction with *-D*.
*-D* 'dir', *--datadir* 'dir'::
- ('also interactively') Specify the (data) directory to use. If not specified,
- the default directory is *~/.calcurse/*. See section <<_files,FILES>> for
- the interaction with *-C*.
+ ('also interactively') Specify the (data) directory to use. See section
+ <<_files,FILES>> for the default directory and the interaction with *-C*.
*-d* 'date|num', *--day* 'date|num'::
Print appointments and events for the given date or given range of days,
@@ -622,15 +620,15 @@ The following structure is created by default in your home directory the
first time calcurse is run without any options:
----
-$HOME/.calcurse/
- |___apts
- |___conf
- |___hooks/
- |___keys
- |___notes/
- |___todo
+$XDG_DATA_HOME/calcurse/ $XDG_CONFIG_HOME/calcurse/
+ |___apts |___conf
+ |___notes/ |___hooks/
+ |___todo |___keys
----
++$XDG_DATA_HOME+ defaults to +$HOME/.local/share+ and +$XDG_CONFIG_HOME+
+defaults to +$HOME/.config+.
+
The files are of two different kinds: data and configuration. The data files
constitute the calcurse database and are independent of the calcurse release
version; the configuration files depend on the calcurse version although
@@ -661,14 +659,16 @@ scripts, see <<_hooks,Hooks>>.
Directory configuration
~~~~~~~~~~~~~~~~~~~~~~~
-An alternative directory to the default +$HOME/.calcurse+ may be specified
-with the *-D* option.
+An alternative directory for 'both' the configuration files and the data
+directory may be specified with the *-D* option.
An alternative directory for the configuration files 'only' may be specified
with the *-C* option; in that case data files are either in the default
-directory or in the directory specified by *-D*. If both *-D* and
-*-C* are present, configuration files in the data directory, if any, are
-ignored.
+directory or in the directory specified by *-D*. If both *-D* and *-C* are
+present, configuration files in the data directory, if any, are ignored.
+
+If +$HOME/.calcurse+ exists, then it will be used as the default for both the
+data directory and the configuration directory.
----
<datadir> <confdir>
@@ -677,7 +677,10 @@ ignored.
|__ todo |___ keys
|__ notes/ |___ hooks/
-default for both: $HOME/.calcurse/
+defaults:
+ <datadir>: $XDG_DATA_HOME/calcurse ($HOME/.local/share/calcurse)
+ <confdir>: $XDG_CONFIG_HOME/calcurse ($HOME/.config/calcurse)
+ both: $HOME/.calcurse (only if it exists)
----
calcurse may switch between two configuration setups, but still access
@@ -686,15 +689,16 @@ the same data files e.g. with:
----
$ calcurse
-$ calcurse -C "$HOME/.calcurse/config"
+$ calcurse -C "$HOME/.config/calcurse/config"
----
Hooks
~~~~~
-Scripts placed in +$HOME/.calcurse/hooks/+ trigger actions at certain
-events. To enable a hook, add a script with one of the following names to this
-directory. Also make sure the script is executable.
+Scripts placed in +<confdir>/calcurse/hooks/+
+(see <<_directory_configuration,Directory configuration>>) trigger actions at
+certain events. To enable a hook, add a script with one of the following names
+to this directory. Also make sure the script is executable.
*pre-load*::
Executed before the data files are loaded.
@@ -728,6 +732,8 @@ A few environment variables affect how calcurse operates.
Tool used to merge two files to solve a save conflict. Default is +vimdiff+.
The program is called with two file names as the only arguments.
+See also <<_files,FILES>>.
+
BUGS
----
@@ -758,5 +764,5 @@ AUTHORS
COPYRIGHT
---------
-Copyright (c) 2004-2018 calcurse Development Team.
+Copyright (c) 2004-2020 calcurse Development Team.
This software is released under the BSD License.
diff --git a/doc/credits.txt b/doc/credits.txt
index b9ce181..ac7c1ab 100644
--- a/doc/credits.txt
+++ b/doc/credits.txt
@@ -1,7 +1,7 @@
Calcurse - text-based organizer
===============================
-Copyright (c) 2004-2017 calcurse Development Team
+Copyright (c) 2004-2020 calcurse Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/doc/de/credits.txt b/doc/de/credits.txt
index b9ce181..ac7c1ab 100644
--- a/doc/de/credits.txt
+++ b/doc/de/credits.txt
@@ -1,7 +1,7 @@
Calcurse - text-based organizer
===============================
-Copyright (c) 2004-2017 calcurse Development Team
+Copyright (c) 2004-2020 calcurse Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/doc/es/credits.txt b/doc/es/credits.txt
index b9ce181..ac7c1ab 100644
--- a/doc/es/credits.txt
+++ b/doc/es/credits.txt
@@ -1,7 +1,7 @@
Calcurse - text-based organizer
===============================
-Copyright (c) 2004-2017 calcurse Development Team
+Copyright (c) 2004-2020 calcurse Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/doc/fr/credits.txt b/doc/fr/credits.txt
index b9ce181..ac7c1ab 100644
--- a/doc/fr/credits.txt
+++ b/doc/fr/credits.txt
@@ -1,7 +1,7 @@
Calcurse - text-based organizer
===============================
-Copyright (c) 2004-2017 calcurse Development Team
+Copyright (c) 2004-2020 calcurse Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/doc/manual.txt b/doc/manual.txt
index ff5131f..cb59e8d 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -1,6 +1,6 @@
////
/*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -176,9 +176,14 @@ long options are supported):
be specified using the `-c` flag.
`-c <file>, --calendar <file>`::
- Specify the calendar file to use. The default calendar is `~/.calcurse/apts`
- (see section <<basics_files,calcurse files>>). This option has precedence
- over `-D`.
+ Specify the calendar file to use. The default calendar is located at
+ `<datadir>/apts` (see section <<basics_files,calcurse files>>). This option
+ has precedence over `-D`.
+
+`-C <dir>, --directory <dir>`::
+ Specify the configuration directory to use. See
+ <<basics_files,calcurse files>> for the default directory and for the
+ interaction with `-D`.
`-d <date|num>, --day <date|num>`::
Print the appointments for the given date or for the given number of
@@ -209,8 +214,8 @@ can be specified using the `-c` flag.
combined with `--to`.
`-D <dir>, --directory <dir>`::
- Specify the data directory to use. If not specified, the default directory is
- `~/.calcurse/`.
+ Specify the (data) directory to use. See <<basics_files,calcurse files>> for
+ the default directory and for the interaction with `-C`.
`--filter-type <type>`::
Ignore any items that do not match the type mask. See
@@ -632,10 +637,13 @@ The following environment variables affect the way `calcurse` operates:
Specifies the default viewer to be used for reading notes. If this variable
is not set, then `/usr/bin/less` is used.
+See also <<basics_files,calcurse files>>.
+
Hooks
~~~~~
-You can place scripts in `$HOME/.calcurse/hooks/` to trigger actions at certain
+You can place scripts in `<confdir>/hooks/`
+(see section <<basics_files,calcurse files>>) to trigger actions at certain
events. To enable a hook, add a script with one of the following names to this
directory. Also make sure the scripts are executable.
@@ -850,17 +858,28 @@ NOTE: To stop the daemon, just send the `TERM` signal to it, using a command
calcurse files
~~~~~~~~~~~~~~
-The following structure is created in your `$HOME` directory (or in the
-directory you specified with the -D option) the first time `calcurse` is run
-:
+An alternative directory for 'both' the configuration files and the data
+directory may be specified with the `-D` option.
+
+An alternative directory for the configuration files 'only' may be specified
+with the `-C` option; in that case data files are either in the default
+directory or in the directory specified by `-D`. If both `-D` and `-C` are
+present, configuration files in the data directory, if any, are ignored.
+
+If +$HOME/.calcurse+ exists, then it will be used as the default for both the
+data directory and the configuration directory.
----
-$HOME/.calcurse/
- |___notes/
- |___conf
- |___keys
- |___apts
- |___todo
+<datadir> <confdir>
+ | |
+ |__ apts |___ conf
+ |__ todo |___ keys
+ |__ notes/ |___ hooks/
+
+defaults:
+ <datadir>: $XDG_DATA_HOME/calcurse ($HOME/.local/share/calcurse)
+ <confdir>: $XDG_CONFIG_HOME/calcurse ($HOME/.config/calcurse)
+ both: $HOME/.calcurse (only if it exists)
----
`notes/`::
this subdirectory contains descriptions of the notes which are attached to
@@ -868,19 +887,22 @@ $HOME/.calcurse/
SHA1 hash of the note itself, multiple items can share the same note file.
calcurse provides a garbage collector (see the `-g` command line parameter)
that can be used to remove note files which are no longer linked to any item.
-`conf`::
- this file contains the user configuration
-`keys`::
- this file contains the user-defined key bindings
`apts`::
this file contains all of the events and user's appointments
`todo`::
this file contains the todo list
+`conf`::
+ this file contains the user configuration
+`keys`::
+ this file contains the user-defined key bindings
+`hooks/`::
+ this subdirectory contains scripts that you can use to trigger actions at
+ certain events (see <<_hooks,Hooks>>)
NOTE: If the logging of calcurse daemon activity was set in the notification
- configuration menu, the extra file `daemon.log` will appear in calcurse
- data directory. This file contains logs about calcurse activity when
- running in background.
+ configuration menu, the extra file `daemon.log` will appear in the
+ calcurse data directory. This file contains logs about calcurse activity
+ when running in background.
Import/Export capabilities
~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/nl/credits.txt b/doc/nl/credits.txt
index b9ce181..ac7c1ab 100644
--- a/doc/nl/credits.txt
+++ b/doc/nl/credits.txt
@@ -1,7 +1,7 @@
Calcurse - text-based organizer
===============================
-Copyright (c) 2004-2017 calcurse Development Team
+Copyright (c) 2004-2020 calcurse Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/doc/pt_BR/credits.txt b/doc/pt_BR/credits.txt
index d5a4231..5cddabc 100644
--- a/doc/pt_BR/credits.txt
+++ b/doc/pt_BR/credits.txt
@@ -1,7 +1,7 @@
Calcurse - organizador baseado em texto
=======================================
-Copyright (c) 2004-2017 Equipe de Desenvolvimento do Calcurse
+Copyright (c) 2004-2020 Equipe de Desenvolvimento do Calcurse
Todos os direitos reservados.
A redistribuição e uso na forma de código-fonte e binário, com ou
diff --git a/doc/ru/credits.txt b/doc/ru/credits.txt
index b9ce181..ac7c1ab 100644
--- a/doc/ru/credits.txt
+++ b/doc/ru/credits.txt
@@ -1,7 +1,7 @@
Calcurse - text-based organizer
===============================
-Copyright (c) 2004-2017 calcurse Development Team
+Copyright (c) 2004-2020 calcurse Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/doc/save.txt b/doc/save.txt
index 9c453ba..780df9b 100644
--- a/doc/save.txt
+++ b/doc/save.txt
@@ -5,11 +5,15 @@ Save calcurse data.
Data are split into four different files which contain :
- / ~/.calcurse/conf -> user configuration
+ / $XDG_CONFIG_HOME/calcurse/conf -> user configuration
| (layout, color, general options)
- | ~/.calcurse/apts -> data related to the appointments
- | ~/.calcurse/todo -> data related to the todo list
- \ ~/.calcurse/keys -> user-defined key bindings
+ | $XDG_DATA_HOME/calcurse/apts -> data related to the appointments
+ | $XDG_DATA_HOME/calcurse/todo -> data related to the todo list
+ \ $XDG_CONFIG_HOME/calcurse/keys -> user-defined key bindings
+
+Defaults:
+- datadir: $XDG_DATA_HOME/calcurse (~/.local/share/calcurse)
+- configdir: $XDG_CONFIG_HOME/calcurse (~/.config/calcurse)
In the config menu, you can choose to save the calcurse data automatically
before quitting.
diff --git a/doc/submitting-patches.txt b/doc/submitting-patches.txt
index cec82ae..056bfb5 100644
--- a/doc/submitting-patches.txt
+++ b/doc/submitting-patches.txt
@@ -1,6 +1,6 @@
////
/*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/po/calcurse.pot b/po/calcurse.pot
index b0914ef..c2e892b 100644
--- a/po/calcurse.pot
+++ b/po/calcurse.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: bugs@calcurse.org\n"
-"POT-Creation-Date: 2019-06-16 15:27-0400\n"
+"POT-Creation-Date: 2020-01-30 19:14+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -377,6 +377,9 @@ msgstr ""
msgid "(insert an empty line after each appointment)"
msgstr ""
+msgid "(text for a day without events and appointments)"
+msgstr ""
+
msgid "(display more than one day in the appointments panel)"
msgstr ""
@@ -431,6 +434,9 @@ msgstr ""
msgid "(Format of the date displayed in the appointments panel)"
msgstr ""
+msgid "Enter a text string (an empty string for the default text)"
+msgstr ""
+
msgid "Enter the date format (see 'man 3 strftime' for possible formats) "
msgstr ""
@@ -474,9 +480,6 @@ msgstr ""
msgid "unknown item type"
msgstr ""
-msgid "(none)"
-msgstr ""
-
msgid "Event:"
msgstr ""
diff --git a/scripts/calcurse-upgrade.sh.in b/scripts/calcurse-upgrade.sh.in
index 117ac37..c9c9c78 100644
--- a/scripts/calcurse-upgrade.sh.in
+++ b/scripts/calcurse-upgrade.sh.in
@@ -4,7 +4,7 @@ export TEXTDOMAIN='calcurse'
set -e
-CONFFILE=$HOME/.calcurse/conf
+[ -d "$HOME/.calcurse" ] && CONFFILE="$HOME/.calcurse/conf" || CONFFILE="${XDG_CONFIG_HOME:-$HOME/.config}/calcurse/conf"
if [ "$#" -gt 0 ]; then
if [ "$1" = "--config" ]; then
@@ -15,7 +15,7 @@ if [ "$#" -gt 0 ]; then
elif [ "$1" = "-v" -o "$1" = "--version" ]; then
echo "calcurse-upgrade @PACKAGE_VERSION@"
echo "$(gettext "
-Copyright (c) 2004-2017 calcurse Development Team.
+Copyright (c) 2004-2020 calcurse Development Team.
This is free software; see the source for copying conditions.
")"
else
diff --git a/src/apoint.c b/src/apoint.c
index 5a9802a..77ff8a0 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/args.c b/src/args.c
index e6444e4..bd58960 100644
--- a/src/args.c
+++ b/src/args.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -112,7 +112,7 @@ static void version_arg(void)
{
printf(_("calcurse %s -- text-based organizer\n"), VERSION);
putchar('\n');
- printf("%s\n", _("Copyright (c) 2004-2017 calcurse Development Team."));
+ printf("%s\n", _("Copyright (c) 2004-2020 calcurse Development Team."));
printf("%s\n", _("This is free software; see the source for copying conditions."));
}
diff --git a/src/calcurse.c b/src/calcurse.c
index 7eb6b12..296616c 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/calcurse.h b/src/calcurse.h
index 39f46b7..419915e 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -84,7 +84,8 @@
#endif /* ENABLE_NLS */
/* Paths configuration. */
-#define DIR_NAME ".calcurse/"
+#define DIR_NAME "calcurse/"
+#define DIR_NAME_LEGACY ".calcurse/"
#define TODO_PATH_NAME "todo"
#define APTS_PATH_NAME "apts"
#define CONF_PATH_NAME "conf"
@@ -160,8 +161,11 @@
#define KEYS_LABELEN 8 /* length of command description */
#define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */
-/* Register definitions. */
-#define REG_BLACK_HOLE 37
+/*
+ * Register definitions, see ui_day.c.
+ * Index 0-35 is used for '0'-'9' and 'a'-'z', see keys_get().
+ */
+#define REG_BLACK_HOLE 36
/* Size of the hash table the note garbage collector uses. */
#define NOTE_GC_HSIZE 1024
@@ -1114,6 +1118,7 @@ void ui_day_item_delete(unsigned);
void ui_day_item_edit(void);
void ui_day_item_pipe(void);
void ui_day_item_repeat(void);
+void ui_day_item_cut(unsigned);
void ui_day_item_cut_free(unsigned);
void ui_day_item_copy(unsigned);
void ui_day_item_paste(unsigned);
diff --git a/src/config.c b/src/config.c
index c6914f5..27324e1 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/custom.c b/src/custom.c
index dafb801..575960a 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/day.c b/src/day.c
index a8ee736..29184d9 100644
--- a/src/day.c
+++ b/src/day.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/dmon.c b/src/dmon.c
index 0772394..f9bbfd2 100644
--- a/src/dmon.c
+++ b/src/dmon.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/event.c b/src/event.c
index c16ca4e..375dd66 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/getstring.c b/src/getstring.c
index 526e9ba..7cdb84e 100644
--- a/src/getstring.c
+++ b/src/getstring.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/help.c b/src/help.c
index 1d6c366..398fb6d 100644
--- a/src/help.c
+++ b/src/help.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/hooks.c b/src/hooks.c
index b34313c..20aed69 100644
--- a/src/hooks.c
+++ b/src/hooks.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/htable.h b/src/htable.h
index 93f65b3..5266213 100644
--- a/src/htable.h
+++ b/src/htable.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/ical.c b/src/ical.c
index 95489a0..79b15de 100644
--- a/src/ical.c
+++ b/src/ical.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/io.c b/src/io.c
index 5c6d254..49892c5 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -136,24 +136,52 @@ unsigned io_fprintln(const char *fname, const char *fmt, ...)
/*
* Initialization of data paths. The cfile argument is the variable
* which contains the calendar file. If none is given, then the default
- * one (~/.calcurse/apts) is taken. If the one given does not exist, it
- * is created.
+ * one (~/.local/share/calcurse/apts) is taken. If the one given does not exist,
+ * it is created.
* The datadir argument can be used to specify an alternative data root dir.
* The confdir argument can be used to specify an alternative configuration dir.
+ * If ~/.calcurse exists, it will be used instead for backward compatibility.
*/
void io_init(const char *cfile, const char *datadir, const char *confdir)
{
- if (!datadir) {
- if (!(datadir = getenv("HOME")))
- datadir = ".";
- asprintf(&path_ddir, "%s%s", datadir, "/" DIR_NAME);
- } else
- asprintf(&path_ddir, "%s%s", datadir, "/");
+ char* home_dir = getenv("HOME");
+ char* legacy_dir = NULL;
+
+ if (home_dir) {
+ asprintf(&legacy_dir, "%s%s", home_dir, "/" DIR_NAME_LEGACY);
+ if (!io_dir_exists(legacy_dir)) {
+ mem_free(legacy_dir);
+ legacy_dir = NULL;
+ }
+ }
- if (!confdir)
- asprintf(&path_cdir, "%s%s", path_ddir, "/");
+ if (datadir)
+ asprintf(&path_ddir, "%s%s", datadir, "/");
+ else if (legacy_dir)
+ path_ddir = mem_strdup(legacy_dir);
+ else if ((path_ddir = getenv("XDG_DATA_HOME")))
+ asprintf(&path_ddir, "%s%s", path_ddir, "/" DIR_NAME);
+ else if (home_dir)
+ asprintf(&path_ddir, "%s%s", home_dir, "/.local/share/" DIR_NAME);
else
+ path_ddir = mem_strdup("./." DIR_NAME);
+
+
+ if (confdir)
asprintf(&path_cdir, "%s%s", confdir, "/");
+ else if (datadir)
+ path_cdir = mem_strdup(path_ddir);
+ else if (legacy_dir)
+ path_cdir = mem_strdup(legacy_dir);
+ else if ((path_cdir = getenv("XDG_CONFIG_HOME")))
+ asprintf(&path_cdir, "%s%s", path_cdir, "/" DIR_NAME);
+ else if (home_dir)
+ asprintf(&path_cdir, "%s%s", home_dir, "/.config/" DIR_NAME);
+ else
+ path_cdir = mem_strdup("./." DIR_NAME);
+
+ if (legacy_dir)
+ mem_free(legacy_dir);
/* Data files */
if (cfile) {
@@ -1053,19 +1081,42 @@ int io_check_dir(const char *dir)
if (read_only)
return -1;
+ char *path = mem_strdup(dir);
+ char *index;
+
+ int existed = 1, failed = 0;
errno = 0;
- if (mkdir(dir, 0700) != 0) {
- if (errno != EEXIST) {
- fprintf(stderr,
- _("FATAL ERROR: could not create %s: %s\n"),
- dir, strerror(errno));
- exit_calcurse(EXIT_FAILURE);
- } else {
- return 1;
+ for (index = path + 1; *index; index++) {
+ if (*index == '/') {
+ *index = '\0';
+ if (mkdir(path, 0700) != 0) {
+ if (errno != EEXIST) {
+ failed = 1;
+ break;
+ }
+ } else {
+ existed = 0;
+ }
+ *index = '/';
}
+ }
+
+ if (!failed && mkdir(path, 0700) != 0) {
+ if (errno != EEXIST)
+ failed = 1;
} else {
- return 0;
+ existed = 0;
+ }
+
+ if(failed) {
+ fprintf(stderr,
+ _("FATAL ERROR: could not create %s: %s\n"),
+ path, strerror(errno));
+ exit_calcurse(EXIT_FAILURE);
}
+
+ mem_free(path);
+ return existed;
}
unsigned io_dir_exists(const char *path)
@@ -1114,11 +1165,15 @@ int io_check_file(const char *file)
* Checks if data files exist. If not, create them.
* The following structure has to be created:
*
- * <datadir> <configdir> (default for both: $HOME/.calcurse/)
+ * <datadir> <configdir>
* | |
* |__ apts |___ conf
* |__ todo |___ keys
* |__ notes/ |___ hooks/
+ *
+ * Defaults:
+ * - datadir: $XDG_DATA_HOME/calcurse (~/.local/share/calcurse)
+ * - configdir: $XDG_CONFIG_HOME/calcurse (~/.config/calcurse)
*/
int io_check_data_files(void)
{
diff --git a/src/keys.c b/src/keys.c
index b48aade..3a25a0b 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -297,8 +297,6 @@ enum key keys_get(WINDOW *win, int *count, int *reg)
*reg = ch - '1' + 1;
} else if (ch >= 'a' && ch <= 'z') {
*reg = ch - 'a' + 10;
- } else if (ch == '_') {
- *reg = REG_BLACK_HOLE;
}
ch = keys_wgetch(win);
}
diff --git a/src/listbox.c b/src/listbox.c
index 12c45cc..2b39aa8 100644
--- a/src/listbox.c
+++ b/src/listbox.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/llist.c b/src/llist.c
index 2248dc7..aca0a9d 100644
--- a/src/llist.c
+++ b/src/llist.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/llist.h b/src/llist.h
index c9a6bc6..9533819 100644
--- a/src/llist.h
+++ b/src/llist.h
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/llist_ts.h b/src/llist_ts.h
index 4ca33df..6597cde 100644
--- a/src/llist_ts.h
+++ b/src/llist_ts.h
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/mem.c b/src/mem.c
index 043dfde..8b8a5d5 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/note.c b/src/note.c
index 8d5d09a..92c1ecf 100644
--- a/src/note.c
+++ b/src/note.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/notify.c b/src/notify.c
index 334468b..3d19511 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -537,11 +537,20 @@ int notify_same_item(time_t time)
return same;
}
+/*
+ * Check if an occurrence of a recurrent appointment is currently the "next
+ * upcoming appointment" in the notify bar.
+ */
int notify_same_recur_item(struct recur_apoint *i)
{
int same = 0;
- time_t item_start = 0;
+ time_t item_start;
+ /* Tomorrow? */
+ recur_item_find_occurrence(i->start, i->dur, &i->exc, i->rpt->type,
+ i->rpt->freq, i->rpt->until,
+ NEXTDAY(get_today()), &item_start);
+ /* Today? */
recur_item_find_occurrence(i->start, i->dur, &i->exc, i->rpt->type,
i->rpt->freq, i->rpt->until,
get_today(), &item_start);
diff --git a/src/pcal.c b/src/pcal.c
index 27d1616..36fdd8e 100644
--- a/src/pcal.c
+++ b/src/pcal.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/queue.c b/src/queue.c
index f68e969..a00ebad 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2018 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/recur.c b/src/recur.c
index 7376536..54c43ba 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/sha1.c b/src/sha1.c
index 109dacc..3826c76 100644
--- a/src/sha1.c
+++ b/src/sha1.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/sha1.h b/src/sha1.h
index cb3953c..bdba4e8 100644
--- a/src/sha1.h
+++ b/src/sha1.h
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/sigs.c b/src/sigs.c
index af1766e..02457ae 100644
--- a/src/sigs.c
+++ b/src/sigs.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/strings.c b/src/strings.c
index a84f836..b3dc1c4 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/todo.c b/src/todo.c
index ede3b50..aa77b15 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/ui-calendar.c b/src/ui-calendar.c
index 6d301e6..4a8ef44 100644
--- a/src/ui-calendar.c
+++ b/src/ui-calendar.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/ui-day.c b/src/ui-day.c
index e0e306b..7d571fc 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@
#include "calcurse.h"
-struct day_item day_cut[38] = { {0, 0, 0, {NULL}} };
+/* Cut & paste registers. */
+static struct day_item day_cut[REG_BLACK_HOLE + 1];
/*
* Set the selected day in the calendar from the selected item in the APP panel.
@@ -834,11 +835,7 @@ void ui_day_item_delete(unsigned reg)
return;
}
}
-
- ui_day_item_cut_free(reg);
- p = day_cut_item(listbox_get_sel(&lb_apt));
- day_cut[reg].type = p->type;
- day_cut[reg].item = p->item;
+ ui_day_item_cut(reg);
/* Keep the selection on the same day. */
day_set_sel_data(day_get_item(listbox_get_sel(&lb_apt) - 1));
io_set_modified();
@@ -995,11 +992,7 @@ void ui_day_item_repeat(void)
/* NOTREACHED */
}
day_set_sel_data(&d);
-
- ui_day_item_cut_free(REG_BLACK_HOLE);
- p = day_cut_item(item_nb);
- day_cut[REG_BLACK_HOLE].type = p->type;
- day_cut[REG_BLACK_HOLE].item = p->item;
+ ui_day_item_cut(REG_BLACK_HOLE);
io_set_modified();
ui_calendar_monthly_view_cache_set_invalid();
@@ -1008,9 +1001,23 @@ cleanup:
mem_free(msg_asktype);
}
+/* Delete an item and save it in a register. */
+void ui_day_item_cut(unsigned reg)
+{
+ struct day_item *p;
+
+ ui_day_item_cut_free(reg);
+
+ p = day_cut_item(listbox_get_sel(&lb_apt));
+ day_cut[reg].type = p->type;
+ day_cut[reg].item = p->item;
+}
+
/* Free the current cut item, if any. */
void ui_day_item_cut_free(unsigned reg)
{
+ EXIT_IF(reg > REG_BLACK_HOLE, "illegal register");
+
if (!day_cut[reg].type) {
/* No previously cut item, don't free anything. */
return;
diff --git a/src/ui-todo.c b/src/ui-todo.c
index 8834e39..b546720 100644
--- a/src/ui-todo.c
+++ b/src/ui-todo.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/utf8.c b/src/utf8.c
index b1976af..1fd4c3b 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/utils.c b/src/utils.c
index a9a9e68..c19c800 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -112,7 +112,7 @@ void free_user_data(void)
apoint_llist_free();
recur_apoint_llist_free();
recur_event_llist_free();
- for (i = 0; i <= 37; i++)
+ for (i = 0; i <= REG_BLACK_HOLE; i++)
ui_day_item_cut_free(i);
todo_free_list();
notify_free_app();
diff --git a/src/vars.c b/src/vars.c
index ae690d1..8c1a042 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/vector.c b/src/vector.c
index 5ea893a..fd468ab 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/vector.h b/src/vector.h
index 0013545..86cb3b8 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/wins.c b/src/wins.c
index 51d8072..485c59b 100644
--- a/src/wins.c
+++ b/src/wins.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/Makefile.am b/test/Makefile.am
index 4561a30..d896dc3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,6 +4,12 @@ TESTS = \
true-001.sh \
run-test-001.sh \
run-test-002.sh \
+ io-001.sh \
+ io-002.sh \
+ io-003.sh \
+ io-004.sh \
+ io-005.sh \
+ io-006.sh \
todo-001.sh \
todo-002.sh \
todo-003.sh \
diff --git a/test/README b/test/README
index f45fd0b..c405382 100644
--- a/test/README
+++ b/test/README
@@ -22,7 +22,7 @@ alternative calcurse binary and data directory.
Passing another data directory might cause some failures since many tests are
adapted for the `test/` directory provided by the test suite:
- $ CALCURSE=../src/calcurse DATA_DIR="$HOME/.calcurse/" ./next-001.sh
+ $ CALCURSE=../src/calcurse DATA_DIR="$HOME/.local/share/calcurse/" ./next-001.sh
Running ./next-001.sh... FAIL
Writing tests
diff --git a/test/io-001.sh b/test/io-001.sh
new file mode 100755
index 0000000..77757f6
--- /dev/null
+++ b/test/io-001.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+data=$(mktemp -d)
+
+"$CALCURSE" -a -D "$data"
+[ -f "$data/apts" ] && [ -f "$data/conf" ] && failed=0 || failed=1
+
+rm -rf "$data"
+exit "$failed"
diff --git a/test/io-002.sh b/test/io-002.sh
new file mode 100755
index 0000000..fadd222
--- /dev/null
+++ b/test/io-002.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+data=$(mktemp -d)
+conf=$(mktemp -d)
+
+"$CALCURSE" -a -D "$data" -C "$conf"
+[ -f "$data/apts" ] && [ -f "$conf/conf" ] && failed=0 || failed=1
+
+rm -rf "$data" "$conf"
+exit "$failed"
diff --git a/test/io-003.sh b/test/io-003.sh
new file mode 100755
index 0000000..d52d321
--- /dev/null
+++ b/test/io-003.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+home=$(mktemp -d)
+data="$home/.calcurse"
+
+mkdir "$data"
+HOME="$home" "$CALCURSE" -a
+[ -f "$data/apts" ] && [ -f "$data/conf" ] && failed=0 || failed=1
+
+rm -rf "$home"
+exit "$failed"
diff --git a/test/io-004.sh b/test/io-004.sh
new file mode 100755
index 0000000..cae71b3
--- /dev/null
+++ b/test/io-004.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+home=$(mktemp -d)
+data=$(mktemp -d)
+conf=$(mktemp -d)
+
+HOME="$home" XDG_DATA_HOME="$data" XDG_CONFIG_HOME="$conf" "$CALCURSE" -a
+[ -f "$data/calcurse/apts" ] && [ -f "$conf/calcurse/conf" ] && failed=0 || failed=1
+
+rm -rf "$home" "$data" "$conf"
+exit "$failed"
diff --git a/test/io-005.sh b/test/io-005.sh
new file mode 100755
index 0000000..c5ebcc7
--- /dev/null
+++ b/test/io-005.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+home=$(mktemp -d)
+
+CALCURSE=$(readlink -f "$CALCURSE")
+(unset -v XDG_DATA_HOME XDG_CONFIG_HOME; HOME="$home" "$CALCURSE" -a)
+[ -f "$home/.local/share/calcurse/apts" ] && [ -f "$home/.config/calcurse/conf" ] && failed=0 || failed=1
+
+rm -rf "$home"
+exit "$failed"
diff --git a/test/io-006.sh b/test/io-006.sh
new file mode 100755
index 0000000..4184d9f
--- /dev/null
+++ b/test/io-006.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+dir=$(mktemp -d)
+
+CALCURSE=$(readlink -f "$CALCURSE")
+cd "$dir"
+(unset -v HOME XDG_DATA_HOME XDG_CONFIG_HOME; "$CALCURSE" -a)
+[ -f "$dir/.calcurse/apts" ] && [ -f "$dir/.calcurse/conf" ] && failed=0 || failed=1
+
+rm -rf "$dir"
+exit "$failed"
diff --git a/test/run-test.c b/test/run-test.c
index 69cde23..d1db112 100644
--- a/test/run-test.c
+++ b/test/run-test.c
@@ -1,7 +1,7 @@
/*
* Calcurse - text-based organizer
*
- * Copyright (c) 2004-2017 calcurse Development Team <misc@calcurse.org>
+ * Copyright (c) 2004-2020 calcurse Development Team <misc@calcurse.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without