Org-Mode: Todo state "NEW" not tracked - emacs

I want to track the state changes of my TODO-items, including the date/time an item was created. I've found out that you can add an exclamation mark while defining the TODO states (e.g. TODO(t!)) and a timestamp should get added. This works when I change the state of a TODO item, but not when it is created (neither via org-capture or manually).
My org-todo-keywords definition:
(setq org-todo-keywords '((sequence "TODO(t!)" "IN-PROGRESS(i!)" "WAITING(w!)" "|"
"DONE(d!)" "CANCELED(c#)")))
I've also enabled logging into the LOGBOOK drawer:
(setq org-log-into-drawer t)
When I create a new TODO item via org-capture, no LOGBOOK drawer gets added.
Hiere is my capture template configuration:
(setq org-capture-templates '(("t" "Task"
entry
(file+headline org-todo-file "Tasks")
"* TODO %^{Description}\n\n%?"
:prepend t)
("n" "Note"
entry
(file+headline org-default-notes-file "Notes")
"* %^{Description}\n\n%?\n\n%i")
("l" "Listen"
entry
(file+headline org-listen-read-watch-file
"Listen")
"* %?")
("r" "Read"
entry
(file+headline org-listen-read-watch-file
"Read")
"* %?")
("w" "Watch"
entry
(file+headline org-listen-read-watch-file
"Watch")
"* %?")))))
I'm using Spacemacs, btw.

Related

VSCode - Make custom user snippets overwriting default suggestion

To match my company's coding standards, I'm making custom snippets like so:
// php.json
{
"If block": {
"prefix": ["if"],
"body": ["if ( ${1:condition} )", "{", "\t$0", "}"],
"description": "if block",
},
// ...
}
Then, when I type if + Tab, I have two suggestions:
I'm forced to press enter to actually select the first one, which is my custom made snippet ; the second being PHP's default snippet.
Is there a way to actually ignore PHP's default snippets in case I have the exact same prefix?

Typed racket GUI: pasteboard method set-area-selectable not working

I using the typed/racket/gui package to build an application. I need to turn off the selection box of the pasteboard% that is activated by default. Usually you would do this using the method set-area-selectable but somehow it is not working for me as I am getting this error:
Type Checker: send: method not understood by object
method name: set-area-selectable
object type: (Instance Pasteboard%)
in: (send this set-area-selectable #f)
location...:
Here is my code:
(define-type Graph-Pasteboard%
(Class #:implements/inits Pasteboard%)
)
(: graph-pasteboard% : Graph-Pasteboard%)
(define graph-pasteboard%
(class pasteboard%
(super-new)
(: do-paste (Integer -> Void))
(define/override (do-paste time) (void))
(send this set-area-selectable #f)
))
I have checked the version of that package I have installed and it should support this functionality.
One solution to this would be to override the method on-default-event but this would mean a lot of unnecessary work.

How do you define and call a function in Spacemacs?

I've defined a emacs / lisp function within defun dotspacemacs/user-config () like so:
(defun clientdir ()
"docstring"
neotree-dir "~/Projects/Clients"
)
How do I execute it?
That function will evaluate the neotree-dir variable and discard the result, then evaluate the "~/Projects/Clients" string and return it.
i.e. Your function unconditionally returns the value "~/Projects/Clients" (unless neotree-dir is not bound as a variable, in which case it will trigger an error).
I am guessing that you wanted to call a function called neotree-dir and pass it "~/Projects/Clients" as an argument? That would look like this: (neotree-dir "~/Projects/Clients")
If you want to call the function interactively you must declare it as an interactive function:
(defun clientdir ()
"Invoke `neotree-dir' on ~/Projects/Clients"
(interactive)
(neotree-dir "~/Projects/Clients"))
You can then call it with M-x clientdir RET, or bind it to a key sequence, etc...

How can I add my personal abbreviation to emmet-mode in Emacs?

I'm using emmet-mode in Emacs24.
I want to expand php to <?php ?>, but Emmet doesn't support php abbreviation.
I thought if I insert a line (puthash "php" "<?php ?>;" tbl) between some other addreviation, but it doesn't work. Above all I don't want to write directly emmet-mode.el.
How can I define my abbreviation outside of mode elisp file?
I would use yasnippet for that. Anyway, for emmet-mode:
(puthash "pp" "<?php ${child} ?>" emmet-tag-snippets-table)
As far as I understand, all the preferences for emmet-mode is contained in the hash table emmet-snippets, it then contains nested hash table for per mode specific snippets and aliases.
emmet-snippets = {
"html": {
"snippets": {...}
"aliases": {...}
},
"css": {
"snippets": {...}
"aliases": {...}
}
}
M-x add-mode-abbrev works here with emmet-mode.
There is an inconvenience from add-mode-abbrev, as its uses backward-word internally to catch the expansion wanted. Thus call it without numeric argument, which will default to numeric arg 1, it will bind "php ?>" as expansion. Than M-x edit-abbrevs RET and fix that.

How to make Emacs put access level modifiers in their own indentation level in my C++ code?

I want to indent my C++ code in Emacs in way similar to the "bsd" style, with one difference: access level modifiers must belong in their own indentation level. (Since I do not use either switch or labels/goto, it can be said generally that lines ending in a colon must belong in their own indentation level.) Here is an example:
class somewhat
{
private:
int whatever;
public:
void somehow()
{
if (something_about(whatever))
like_this();
else
{
std::cerr << "It is not true that something_about("
<< whatever << ").";
like_that();
}
}
};
How do I configure my ~/.emacs to reflect this preference? Here is my current configuration:
; No tabs at all.
(setq indent-tabs-width nil)
(setq tab-width 2)
; [C-like languages]-specific configuration.
(setq c-basic-offset 2)
(setq c-default-style "bsd")
; Configuration for other languages.
; ...
You need to modify the access-label indentation in your c-offsets-alist.
I recommend you make a new 'style' with its own c-offsets-alist and add a line like:
(access-label . +)
If you want to derive from bsd style, you can do something like this:
(c-add-style "modified-bsd"
'("bsd"
(c-basic-offset . 2)
;;...MORE MODS...
(c-offsets-alist
(access-label . +))))`
Also, how did I find the offset to modify? Go to the relevant line of code and press
C-cC-s to show the syntactic analysis of CC-mode. Also be sure to check the help for c-offsets-alist.