“Wrong number of arguments: (1 . 2), 0” means that a function expects at least 1 and at most 2 arguments (i.e. 1 mandatory and 1 optional argument), but it was called with 0 arguments.
As npostavs explained in a comment, you can run
M-x toggle-debug-on-error and repeat the action again to get more information. When the error occurs, you'll see a backtrace, which lists the active function calls, from innermost to outermost. The first line is the function that was just called, that's the one which isn't receiving the correct number of arguments. When you've finished reading the backtrace, press
ESC ESC ESC or
C-] to exit the debugging mode.
The help for the function
C-h f ggtags-find-tag-dwim RET) tells you that its call syntax is
(ggtags-find-tag-dwim NAME &optional WHAT)
I.e. it's called with two parameters called
what (the names are capitalized in the help), and the second parameter is optional.
When the function is called interactively, i.e. when it's directly bound to a key (or mouse or other event), Emacs passes it parameters based on the function's interactive specification. Some common examples of automatic parameter passing include the numerical prefix argument, the point or region (point and mark), something typed by the user (arbitrary string, file name, buffer name, etc.), etc. Parameters can also be generated by Lisp code given in the function definition.
You need to pull up the source code to see the interactive specification. The source code will be linked from the function help if it's available. The interactive specification looks like a call to a function called
interactive just below the function's documentation string.
(defun ggtags-find-tag-dwim (name &optional what)
"Find NAME by context.
(let ((include (and (not current-prefix-arg) (ggtags-include-file))))
(if include (list include 'include)
(list (ggtags-read-tag 'definition current-prefix-arg)
(and current-prefix-arg 'definition)))))
You can copy this interactive specification into your own wrapper. But since it's complicated and your wrapper is simple, you should instead tell Emacs to call the function interactively, i.e. to pass parameters automatically as if the function had been directly invoked by pressing a key.
(define-key ggtags-mode-map (kbd "M-.")
For this specific case, since it seems that you always want to run
ggtags-find-tag-dwim, there's a simpler way: the Ggtags package has a customization for this. In the Customize interface, navigate to the Ggtags group (“GNU Global source code tagging system”), and change “Hook run immediately after finding a tag.” to
recenter. Alternatively, put the following line in your init file:
(setq ggtags-find-tag-hook 'recenter)